Task: | Grid |
Sender: | nigus |
Submission time: | 2017-01-19 21:47:08 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.04 s | 1 | details |
#2 | ACCEPTED | 0.03 s | 1 | details |
#3 | WRONG ANSWER | 0.03 s | 1 | details |
#4 | WRONG ANSWER | 0.05 s | 1 | details |
#5 | ACCEPTED | 0.03 s | 1 | details |
#6 | ACCEPTED | 0.05 s | 1 | details |
#7 | ACCEPTED | 0.05 s | 1 | details |
#8 | ACCEPTED | 0.05 s | 1 | details |
#9 | ACCEPTED | 0.05 s | 1 | details |
#10 | ACCEPTED | 0.04 s | 2 | details |
#11 | WRONG ANSWER | 0.04 s | 2 | details |
#12 | WRONG ANSWER | 0.04 s | 2 | details |
#13 | WRONG ANSWER | 0.04 s | 2 | details |
#14 | ACCEPTED | 0.04 s | 2 | details |
#15 | ACCEPTED | 0.05 s | 2 | details |
#16 | ACCEPTED | 0.04 s | 3 | details |
#17 | WRONG ANSWER | 0.03 s | 3 | details |
#18 | WRONG ANSWER | 0.04 s | 3 | details |
#19 | WRONG ANSWER | 0.10 s | 3 | details |
#20 | ACCEPTED | 0.20 s | 3 | details |
#21 | WRONG ANSWER | 0.26 s | 3 | details |
Compiler report
input/code.cpp: In function 'void extend(ll)': input/code.cpp:49:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(ll c2 = 0; c2 < ind.size(); c2++){ ^ input/code.cpp:69:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(ll c2 = 0; c2 < ind.size(); c2++){ ^ input/code.cpp: In function 'int main()': input/code.cpp:104:14: warning: unused variable 'c3' [-Wunused-variable] ll c1,c2,c3,c4,c5; ^ input/code.cpp:104:17: warning: unused variable 'c4' [-Wunused-variable] ll c1,c2,c3,c4,c5; ^ input/code.cpp:104:20: warning: unused variable 'c5' [-Wunused-variable] ll c1,c2,c3,c4,c5; ^ input/code.cpp:105:12: warning: unused variable 'c' [-Wunused-variable] ll a,b,c; ^ input/code.cpp:108:21: warning: ignoring return value of '...
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll mod = 1000000007ll; int n,m,k,x,y; vector<ll> A; ll M[1001][1001] = {0}; vector<ll> sum; vector<ll> ind; vector<ll> kind; vector<ll> num; bool comp(ll i, ll j){ return sum[i] < sum[j]; } 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; } void extend(ll i){ sort(ind.begin() , ind.end() , comp); for(ll c1 = 1; c1 <= i; c1++){ ll curr = 0; ll s1 = c1; ll s2 = c1; set<ll> S; for(ll c2 = 0; c2 < ind.size(); c2++){ curr++; if(curr == c1 && c1 != i){ curr++; } curr = min(curr , i); ll a = ind[c2]; S.insert(sum[a] + curr); if(kind[a] == 0){ s1 += curr; } else{ s2 += curr; } } if(S.find(s1) == S.end() && S.find(s2) == S.end() && s1 != s2){ M[i-1][i-1] = c1; curr = 0; for(ll c2 = 0; c2 < ind.size(); c2++){ curr++; if(curr == c1 && c1 != i){ curr++; } curr = min(curr , i); ll a = ind[c2]; sum[a] += curr; if(kind[a] == 0){ M[num[a]][i-1] = curr; } else{ M[i-1][num[a]] = curr; } } ind.push_back(ind.size()); ind.push_back(ind.size()); sum.push_back(s1); sum.push_back(s2); kind.push_back(0); kind.push_back(1); num.push_back(i-1); num.push_back(i-1); break; } } return; } int main() { //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); ll c1,c2,c3,c4,c5; ll a,b,c; scanf("%d" , &n); if(n <= 3){ printf("QAQ\n"); } else{ if(n <= 1){ 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"; //printf("%d\n" , int(a)); for(c1 = 0; c1 < n; c1++){ for(c2 = 0; c2 < n; c2++){ //cout << A[c1*n+c2] << " "; printf("%d " , int(A[c1*n+c2])); } printf("\n"); //cout << "\n"; } } else{ ll base = 6; for(c1 = 0; c1 < base; c1++){ for(c2 = 0; c2 < base; c2++){ A.push_back(c1+1); } } b = n; n = base; for(c1 = 0; c1 < 1000000; c1++){ random_shuffle(A.begin() , A.end()); if(test()){a = c1;break;} } n = b; for(c1 = 0; c1 < base; c1++){ a = 0; for(c2 = 0; c2 < base; c2++){ a += A[base*c1+c2]; M[c1][c2] = A[base*c1+c2]; } sum.push_back(a); kind.push_back(0); ind.push_back(ind.size()); num.push_back(c1); } for(c1 = 0; c1 < base; c1++){ a = 0; for(c2 = 0; c2 < base; c2++){ a += A[base*c2+c1]; } sum.push_back(a); kind.push_back(1); ind.push_back(ind.size()); num.push_back(c1); } for(c1 = base+1; c1 <= n; c1++){ extend(c1); } for(c1 = 0; c1 < n; c1++){ for(c2 = 0; c2 < n; c2++){ // cout << M[c1][c2] << " "; printf("%d " , int(M[c1][c2])); } //cout << "\n"; printf("\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: WRONG ANSWER
input |
---|
4 |
correct output |
---|
3 4 3 4 3 1 1 2 4 4 3 2 2 2 1 1 |
user output |
---|
5 4 4 4 3 5 2 6 1 3 1 6 4 2 3 3 |
Test 4
Group: 1
Verdict: WRONG ANSWER
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 |
---|
5 4 4 4 6 3 5 2 6 6 1 3 1 6 4 4 2 3 3 2 5 6 2 5 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 4 4 4 6 5 7 3 5 2 6 6 1 7 1 3 1 6 4 1 3 4 2 3 3 2 1 2 5 6 2 5 4 2 7 ... |
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 |
---|
5 4 4 4 6 5 7 8 3 5 2 6 6 1 7 8 1 3 1 6 4 1 3 4 4 2 3 3 2 1 2 2 5 6 2 5 4 2 7 8 ... |
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 |
---|
5 4 4 4 6 5 7 8 9 3 5 2 6 6 1 7 8 9 1 3 1 6 4 1 3 4 4 4 2 3 3 2 1 2 2 3 5 6 2 5 4 2 7 8 9 ... |
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 |
---|
5 4 4 4 6 5 7 8 9 10 3 5 2 6 6 1 7 8 9 9 1 3 1 6 4 1 3 4 4 4 4 2 3 3 2 1 2 2 3 3 5 6 2 5 4 2 7 8 9 10 ... |
Test 10
Group: 2
Verdict: ACCEPTED
input |
---|
3 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 11
Group: 2
Verdict: WRONG ANSWER
input |
---|
4 |
correct output |
---|
3 4 3 4 3 1 1 2 4 4 3 2 2 2 1 1 |
user output |
---|
5 4 4 4 3 5 2 6 1 3 1 6 4 2 3 3 |
Test 12
Group: 2
Verdict: WRONG ANSWER
input |
---|
29 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
5 4 4 4 6 5 7 8 9 10 11 12 12 ... |
Test 13
Group: 2
Verdict: WRONG ANSWER
input |
---|
48 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
5 4 4 4 6 5 7 8 9 10 11 12 12 ... |
Test 14
Group: 2
Verdict: ACCEPTED
input |
---|
80 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
5 4 4 4 6 5 7 8 9 10 11 12 12 ... |
Test 15
Group: 2
Verdict: ACCEPTED
input |
---|
97 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
5 4 4 4 6 5 7 8 9 10 11 12 12 ... |
Test 16
Group: 3
Verdict: ACCEPTED
input |
---|
3 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 17
Group: 3
Verdict: WRONG ANSWER
input |
---|
4 |
correct output |
---|
3 4 3 4 3 1 1 2 4 4 3 2 2 2 1 1 |
user output |
---|
5 4 4 4 3 5 2 6 1 3 1 6 4 2 3 3 |
Test 18
Group: 3
Verdict: WRONG ANSWER
input |
---|
111 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
5 4 4 4 6 5 7 8 9 10 11 12 12 ... |
Test 19
Group: 3
Verdict: WRONG ANSWER
input |
---|
506 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
5 4 4 4 6 5 7 8 9 10 11 12 12 ... |
Test 20
Group: 3
Verdict: ACCEPTED
input |
---|
844 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
5 4 4 4 6 5 7 8 9 10 11 12 12 ... |
Test 21
Group: 3
Verdict: WRONG ANSWER
input |
---|
991 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
5 4 4 4 6 5 7 8 9 10 11 12 12 ... |