| Task: | Grid |
| Sender: | nigus |
| Submission time: | 2017-01-19 21:02:38 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | 35 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 35 |
| #2 | TIME LIMIT EXCEEDED | 0 |
| #3 | TIME LIMIT EXCEEDED | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.03 s | 1 | details |
| #2 | ACCEPTED | 0.06 s | 1 | details |
| #3 | ACCEPTED | 0.04 s | 1 | details |
| #4 | ACCEPTED | 0.04 s | 1 | details |
| #5 | ACCEPTED | 0.04 s | 1 | details |
| #6 | ACCEPTED | 0.04 s | 1 | details |
| #7 | ACCEPTED | 0.04 s | 1 | details |
| #8 | ACCEPTED | 0.04 s | 1 | details |
| #9 | ACCEPTED | 0.04 s | 1 | details |
| #10 | ACCEPTED | 0.04 s | 2 | details |
| #11 | ACCEPTED | 0.04 s | 2 | details |
| #12 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #13 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #14 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #15 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #16 | ACCEPTED | 0.04 s | 3 | details |
| #17 | ACCEPTED | 0.04 s | 3 | details |
| #18 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #19 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #20 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #21 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:34:14: warning: unused variable 'c3' [-Wunused-variable]
ll c1,c2,c3,c4,c5;
^
input/code.cpp:34:17: warning: unused variable 'c4' [-Wunused-variable]
ll c1,c2,c3,c4,c5;
^
input/code.cpp:34:20: warning: unused variable 'c5' [-Wunused-variable]
ll c1,c2,c3,c4,c5;
^
input/code.cpp:35:8: warning: variable 'a' set but not used [-Wunused-but-set-variable]
ll a,b,c;
^
input/code.cpp:35:10: warning: unused variable 'b' [-Wunused-variable]
ll a,b,c;
^
input/code.cpp:35:12: warning: unused variable 'c' [-Wunused-variable]
ll a,b,c;
^Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007ll;
ll n,m,k,x,y;
vector<ll> A;
bool test(){
set<ll> S;
for(ll c1 = 0; c1 < n; c1++){
ll a = 0;
ll b = 0;
for(ll c2 = 0; c2 < n; c2++){
a += A[n*c1 + c2];
b += A[n*c2 + c1];
}
if(S.find(a) != S.end())return 0;
S.insert(a);
if(S.find(b) != S.end())return 0;
S.insert(b);
}
return 1;
}
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ll c1,c2,c3,c4,c5;
ll a,b,c;
cin >> n;
if(n <= 3){
cout << "QAQ\n";
}
else{
for(c1 = 0; c1 < n; c1++){
for(c2 = 0; c2 < n; c2++){
A.push_back(c1+1);
}
}
a = -1;
for(c1 = 0; c1 < 1000000; c1++){
random_shuffle(A.begin() , A.end());
if(test()){a = c1;break;}
}
//cout << a << "\n";
for(c1 = 0; c1 < n; c1++){
for(c2 = 0; c2 < n; c2++){
cout << A[c1*n+c2] << " ";
}
cout << "\n";
}
}
return 0;
}
Test details
Test 1
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 2 |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 2
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 3 |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 3
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 4 |
| correct output |
|---|
| 3 4 3 4 3 1 1 2 4 4 3 2 2 2 1 1 |
| user output |
|---|
| 1 1 3 2 2 1 2 4 3 3 3 4 2 1 4 4 |
Test 4
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 5 |
| correct output |
|---|
| 2 3 4 1 1 3 4 2 1 2 4 2 3 1 3 4 3 2 1 4 5 5 5 5 5 |
| user output |
|---|
| 1 1 5 3 1 5 4 4 2 3 1 2 3 1 2 5 5 2 2 3 4 3 5 4 4 |
Test 5
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 6 |
| correct output |
|---|
| 2 3 4 5 1 1 3 4 5 2 1 2 4 5 2 3 1 3 5 2 3 4 1 4 5 4 3 2 1 5 ... |
| user output |
|---|
| 5 4 4 4 6 5 3 5 2 6 6 1 1 3 1 6 4 1 4 2 3 3 2 1 5 6 2 5 4 2 ... |
Test 6
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 7 |
| correct output |
|---|
| 2 3 4 5 6 1 1 3 4 5 6 2 1 2 4 5 6 2 3 1 3 5 6 2 3 4 1 4 6 2 3 4 5 1 5 ... |
| user output |
|---|
| 5 5 6 5 7 4 3 6 2 1 1 4 3 1 4 7 1 4 5 7 1 2 7 5 1 7 2 3 2 4 2 6 3 4 5 ... |
Test 7
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 8 |
| correct output |
|---|
| 2 3 4 5 6 7 1 1 3 4 5 6 7 2 1 2 4 5 6 7 2 3 1 3 5 6 7 2 3 4 1 4 6 7 2 3 4 5 1 5 ... |
| user output |
|---|
| 6 4 2 3 8 4 4 6 3 6 7 5 6 1 4 2 5 8 8 3 7 5 1 6 7 2 7 8 4 3 6 8 3 2 5 8 1 1 4 3 ... |
Test 8
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 9 |
| correct output |
|---|
| 2 3 4 5 6 7 8 1 1 3 4 5 6 7 8 2 1 2 4 5 6 7 8 2 3 1 3 5 6 7 8 2 3 4 1 4 6 7 8 2 3 4 5 1 5 ... |
| user output |
|---|
| 1 8 1 9 4 2 4 3 1 3 7 7 2 7 8 4 7 2 9 8 3 9 6 8 7 4 1 3 4 1 5 5 5 5 7 5 2 2 5 6 6 4 1 9 6 ... |
Test 9
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 10 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 1 1 3 4 5 6 7 8 9 2 1 2 4 5 6 7 8 9 2 3 1 3 5 6 7 8 9 2 3 4 1 4 6 7 8 9 2 3 4 5 1 5 ... |
| user output |
|---|
| 10 1 2 3 4 5 6 6 8 9 8 10 9 9 8 7 10 4 7 3 7 4 9 8 1 8 1 3 1 7 5 3 6 9 10 3 5 2 9 1 4 5 1 6 4 4 5 2 9 6 ... |
Test 10
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 3 |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 11
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 4 |
| correct output |
|---|
| 3 4 3 4 3 1 1 2 4 4 3 2 2 2 1 1 |
| user output |
|---|
| 1 1 3 2 2 1 2 4 3 3 3 4 2 1 4 4 |
Test 12
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 29 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 13
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 48 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 14
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 80 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 15
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 97 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 16
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 3 |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 17
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 4 |
| correct output |
|---|
| 3 4 3 4 3 1 1 2 4 4 3 2 2 2 1 1 |
| user output |
|---|
| 1 1 3 2 2 1 2 4 3 3 3 4 2 1 4 4 |
Test 18
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 111 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 19
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 506 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 20
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 844 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 21
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 991 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
