Task: | Grid |
Sender: | koosaga |
Submission time: | 2017-01-21 08:04:47 +0200 |
Language: | C++ |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 35 |
#2 | ACCEPTED | 21 |
#3 | ACCEPTED | 44 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.04 s | 1 | details |
#2 | ACCEPTED | 0.05 s | 1 | details |
#3 | ACCEPTED | 0.04 s | 1 | details |
#4 | ACCEPTED | 0.05 s | 1 | details |
#5 | ACCEPTED | 0.03 s | 1 | details |
#6 | ACCEPTED | 0.04 s | 1 | details |
#7 | ACCEPTED | 0.03 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 | ACCEPTED | 0.03 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 | ACCEPTED | 0.04 s | 2 | details |
#16 | ACCEPTED | 0.05 s | 3 | details |
#17 | ACCEPTED | 0.04 s | 3 | details |
#18 | ACCEPTED | 0.05 s | 3 | details |
#19 | ACCEPTED | 0.08 s | 3 | details |
#20 | ACCEPTED | 0.13 s | 3 | details |
#21 | ACCEPTED | 0.14 s | 3 | details |
Code
#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef long double llf; int n, a[1005][1005]; int main(){ cin >> n; if(n <= 3){ puts("QAQ"); return 0; } if(n == 4){ puts("1 1 1 2\n1 2 2 3\n2 3 4 4\n3 4 4 3"); return 0; } for(int i=2; i<n; i++){ for(int j=2; j<n; j++){ a[i][j] = (i + j - 4) % (n-2) + 2; } } for(int i=2; i<n; i++){ a[1][i] = a[i][1] = i; } a[1][1] = 1; for(int i=1; i<=n; i++) a[i][n] = n; for(int i=1; i<n; i++) a[n][i] = 1; for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ printf("%d ", a[i][j]); } puts(""); } }
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 1 2 1 2 2 3 2 3 4 4 3 4 4 3 |
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 2 3 4 5 2 2 3 4 5 3 3 4 2 5 4 4 2 3 5 1 1 1 1 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 2 3 4 5 6 2 2 3 4 5 6 3 3 4 5 2 6 4 4 5 2 3 6 5 5 2 3 4 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 2 3 4 5 6 7 2 2 3 4 5 6 7 3 3 4 5 6 2 7 4 4 5 6 2 3 7 5 5 6 2 3 4 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 2 3 4 5 6 7 8 2 2 3 4 5 6 7 8 3 3 4 5 6 7 2 8 4 4 5 6 7 2 3 8 5 5 6 7 2 3 4 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 |
---|
1 2 3 4 5 6 7 8 9 2 2 3 4 5 6 7 8 9 3 3 4 5 6 7 8 2 9 4 4 5 6 7 8 2 3 9 5 5 6 7 8 2 3 4 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 |
---|
1 2 3 4 5 6 7 8 9 10 2 2 3 4 5 6 7 8 9 10 3 3 4 5 6 7 8 9 2 10 4 4 5 6 7 8 9 2 3 10 5 5 6 7 8 9 2 3 4 10 ... |
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 1 2 1 2 2 3 2 3 4 4 3 4 4 3 |
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 2 3 4 5 6 7 8 9 10 11 12 13 ... |
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 2 3 4 5 6 7 8 9 10 11 12 13 ... |
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 2 3 4 5 6 7 8 9 10 11 12 13 ... |
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 |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
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 1 2 1 2 2 3 2 3 4 4 3 4 4 3 |
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 2 3 4 5 6 7 8 9 10 11 12 13 ... |
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 2 3 4 5 6 7 8 9 10 11 12 13 ... |
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 2 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 21
Group: 3
Verdict: ACCEPTED
input |
---|
991 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |