QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#446435 | #8474. Matrices and Sums | 5ab | AC ✓ | 26ms | 3708kb | C++20 | 806b | 2024-06-17 10:26:55 | 2024-06-17 10:26:55 |
Judging History
answer
/* name: H
* author: 5ab
* created at: 2024-06-17
*/
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ssz(x) (int((x).size()))
auto chmax = [](auto& x, auto y) { if (x < y) x = y; };
auto chmin = [](auto& x, auto y) { if (y < x) x = y; };
using ll = long long;
const int s[2][2] = { {-1, 1}, { 0, 1 } };
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
if (n & 1)
{
cout << "No\n";
return 0;
}
cout << "Yes\n";
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
{
if (i / 2 == j / 2)
cout << s[i % 2][j % 2];
else
cout << (max(i, j) & 1 ? 1 : -1);
cout << " \n"[j == n - 1];
}
return 0;
}
// started coding at: 06-17 10:22:53
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3648kb
input:
2
output:
Yes -1 1 0 1
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1
output:
No
result:
ok OK, Accepted.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
3
output:
No
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3572kb
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: 3600kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3604kb
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: 3576kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: 0
Accepted
time: 0ms
memory: 3648kb
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: 3600kb
input:
9
output:
No
result:
ok OK, Accepted.
Test #10:
score: 0
Accepted
time: 1ms
memory: 3636kb
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: 3600kb
input:
21
output:
No
result:
ok OK, Accepted.
Test #12:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
37
output:
No
result:
ok OK, Accepted.
Test #13:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
73
output:
No
result:
ok OK, Accepted.
Test #14:
score: 0
Accepted
time: 1ms
memory: 3616kb
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...
result:
ok OK, Accepted.
Test #15:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
233
output:
No
result:
ok OK, Accepted.
Test #16:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
555
output:
No
result:
ok OK, Accepted.
Test #17:
score: 0
Accepted
time: 9ms
memory: 3640kb
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 -...
result:
ok OK, Accepted.
Test #18:
score: 0
Accepted
time: 21ms
memory: 3652kb
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 -...
result:
ok OK, Accepted.
Test #19:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
999
output:
No
result:
ok OK, Accepted.
Test #20:
score: 0
Accepted
time: 26ms
memory: 3708kb
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 -...
result:
ok OK, Accepted.