QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#564990 | #8474. Matrices and Sums | ucup-team1231# | AC ✓ | 38ms | 7848kb | C++14 | 824b | 2024-09-15 19:18:13 | 2024-09-15 19:18:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int n, a[1005][1005];
int main() {
scanf("%d", &n);
if(n & 1) printf("No\n");
else {
printf("Yes\n");
for(int i = 0; i < n; i += 2)
for(int j = 0; j < n; j += 2)
if(i < j) a[i][j] = a[i + 1][j] = a[i][j + 1] = a[i + 1][j + 1] = 1;
else if(i > j) a[i][j] = a[i + 1][j] = a[i][j + 1] = a[i + 1][j + 1] = -1;
else {
a[i][j] = 1;
a[i][j + 1] = 1;
a[i + 1][j] = 0;
a[i + 1][j + 1] = -1;
}
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++)
printf("%d ", a[i][j]);
printf("\n");
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3984kb
input:
2
output:
Yes 1 1 0 -1
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
1
output:
No
result:
ok OK, Accepted.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
3
output:
No
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
4
output:
Yes 1 1 1 1 0 -1 1 1 -1 -1 1 1 -1 -1 0 -1
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
6
output:
Yes 1 1 1 1 1 1 0 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 0 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 0 -1
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
8
output:
Yes 1 1 1 1 1 1 1 1 0 -1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 -1 -1 0 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 0 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 0 -1
result:
ok OK, Accepted.
Test #9:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
9
output:
No
result:
ok OK, Accepted.
Test #10:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
10
output:
Yes 1 1 1 1 1 1 1 1 1 1 0 -1 1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 0 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 0 -1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 -1 -1 0 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1
result:
ok OK, Accepted.
Test #11:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
21
output:
No
result:
ok OK, Accepted.
Test #12:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
37
output:
No
result:
ok OK, Accepted.
Test #13:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
73
output:
No
result:
ok OK, Accepted.
Test #14:
score: 0
Accepted
time: 1ms
memory: 4304kb
input:
100
output:
Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok OK, Accepted.
Test #15:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
233
output:
No
result:
ok OK, Accepted.
Test #16:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
555
output:
No
result:
ok OK, Accepted.
Test #17:
score: 0
Accepted
time: 15ms
memory: 6472kb
input:
666
output:
Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok OK, Accepted.
Test #18:
score: 0
Accepted
time: 32ms
memory: 7512kb
input:
888
output:
Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok OK, Accepted.
Test #19:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
999
output:
No
result:
ok OK, Accepted.
Test #20:
score: 0
Accepted
time: 38ms
memory: 7848kb
input:
1000
output:
Yes 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok OK, Accepted.