Task: | Grid |
Sender: | cuber2460 |
Submission time: | 2017-01-21 22:33:12 +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 | WRONG ANSWER | 0.04 s | 1 | details |
#2 | WRONG ANSWER | 0.04 s | 1 | details |
#3 | WRONG ANSWER | 0.04 s | 1 | details |
#4 | WRONG ANSWER | 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 | WRONG ANSWER | 0.04 s | 1 | details |
#9 | ACCEPTED | 0.04 s | 1 | details |
#10 | WRONG ANSWER | 0.04 s | 2 | details |
#11 | WRONG ANSWER | 0.04 s | 2 | details |
#12 | ACCEPTED | 0.04 s | 2 | details |
#13 | ACCEPTED | 0.05 s | 2 | details |
#14 | ACCEPTED | 0.04 s | 2 | details |
#15 | WRONG ANSWER | 0.04 s | 2 | details |
#16 | WRONG ANSWER | 0.03 s | 3 | details |
#17 | WRONG ANSWER | 0.03 s | 3 | details |
#18 | ACCEPTED | 0.03 s | 3 | details |
#19 | ACCEPTED | 0.07 s | 3 | details |
#20 | ACCEPTED | 0.10 s | 3 | details |
#21 | WRONG ANSWER | 0.44 s | 3 | details |
Code
#include <iostream> #include <set> #include <algorithm> #include <vector> using namespace std; const int N = 1000; int n; int t[N + 7][N + 7]; int sum1[N + 7]; int sum2[N + 7]; int ile[N + 7]; bool popraw() { vector <int> S; for(int i = 1; i <= n; ++i) { for(int j = 1; j <= n; ++j) { sum1[i] += t[i][j]; sum2[j] += t[i][j]; } } for(int i = 1; i <= n; ++i) { S.push_back(sum1[i]); S.push_back(sum2[i]); } sort(S.begin(), S.end()); int ok = 1; for(int i = 1; i < (int) S.size(); ++i) if(S[i] == S[i - 1]) ok = 0; if(ok) return 1; swap(t[1 + rand() % n][1 + rand() % n], t[1 + rand() % n][1 + rand() % n]); return 0; } int main() { ios_base::sync_with_stdio(0); cin >> n; for(int i = 1; i <= n; ++i) { for(int j = 1; j <= n; ++j) { if(i + j <= n + 1) { t[i][j] = (i + j - 2) * (i + j - 1) / 2; t[i][j] += i; } else { int x = n - i + 1; int y = n - j + 1; t[i][j] = n * n - (x + y - 2) * (x + y - 1) / 2 - x + 1 ; } t[i][j] = (t[i][j] + n - 1) / n; } } while(!popraw()); for(int i = 1; i <= n; ++i) { for(int j = 1; j <= n; ++j) cout << t[i][j] << ' '; cout << endl; } return 0; }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
2 |
correct output |
---|
QAQ |
user output |
---|
2 1 2 1 |
Test 2
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 |
correct output |
---|
QAQ |
user output |
---|
1 1 2 3 1 3 2 2 3 |
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 |
---|
1 1 1 2 1 2 2 4 2 3 3 4 3 4 3 4 |
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 |
---|
1 1 1 2 3 1 1 2 3 4 3 2 3 4 4 2 2 4 5 5 3 4 5 5 5 |
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 |
---|
1 1 1 2 2 3 1 1 2 2 3 4 1 2 3 3 4 5 2 3 4 4 5 6 3 4 5 5 6 6 ... |
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 |
---|
1 1 1 1 2 3 4 1 1 2 3 5 4 5 1 2 2 3 4 3 5 2 2 2 4 5 6 6 3 3 4 5 6 6 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 |
---|
1 1 1 1 2 2 3 4 1 1 1 2 3 3 4 5 1 2 2 3 3 4 5 6 2 2 3 4 4 5 6 7 2 3 4 5 5 6 7 7 ... |
Test 8
Group: 1
Verdict: WRONG ANSWER
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 1 1 1 2 2 3 5 5 1 1 1 8 2 3 4 4 6 1 1 2 2 3 4 5 6 6 2 2 3 3 4 5 6 7 7 2 3 3 4 5 6 7 7 8 ... |
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 |
---|
1 1 1 1 2 2 3 3 4 5 1 1 1 2 2 3 3 4 5 6 1 1 2 2 3 4 4 5 6 7 1 2 2 3 4 4 5 6 7 8 2 2 3 4 5 5 6 7 8 8 ... |
Test 10
Group: 2
Verdict: WRONG ANSWER
input |
---|
3 |
correct output |
---|
QAQ |
user output |
---|
1 1 2 3 1 3 2 2 3 |
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 |
---|
1 1 1 2 1 2 2 4 2 3 3 4 3 4 3 4 |
Test 12
Group: 2
Verdict: ACCEPTED
input |
---|
29 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
1 1 1 1 1 1 1 1 2 2 2 3 3 4 4 ... |
Test 13
Group: 2
Verdict: ACCEPTED
input |
---|
48 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 2 2 2 2 3 ... |
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 |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 ... |
Test 15
Group: 2
Verdict: WRONG ANSWER
input |
---|
97 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 ... |
Test 16
Group: 3
Verdict: WRONG ANSWER
input |
---|
3 |
correct output |
---|
QAQ |
user output |
---|
1 1 2 3 1 3 2 2 3 |
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 |
---|
1 1 1 2 1 2 2 4 2 3 3 4 3 4 3 4 |
Test 18
Group: 3
Verdict: ACCEPTED
input |
---|
111 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
Test 19
Group: 3
Verdict: ACCEPTED
input |
---|
506 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
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 |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
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 |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |