QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#445809#8474. Matrices and SumssuomynonA#AC ✓31ms7592kbC++20556b2024-06-16 14:46:212024-06-16 14:46:21

Judging History

你现在查看的是最新测评结果

  • [2024-06-16 14:46:21]
  • 评测
  • 测评结果:AC
  • 用时:31ms
  • 内存:7592kb
  • [2024-06-16 14:46:21]
  • 提交

answer

#include <bits/stdc++.h>
const int N = 1e3;
int n, a[N + 5][N + 5];
int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0);
    std::cin >> n;
    if (n & 1) { std::cout << "No\n"; return 0; }
    std::cout << "Yes\n";
    for (int i = 1; i <= n / 2; ++i) for (int j = 1; j <= n - i + 1; ++j) a[i][j] = 1;
    for (int i = n / 2 + 1; i <= n; ++i) for (int j = n; j >= n - i + 2; --j) a[i][j] = -1;
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) std::cout << a[i][j] << " \n"[j == n];
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3612kb

input:

2

output:

Yes
1 1
0 -1

result:

ok OK, Accepted.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1

output:

No

result:

ok OK, Accepted.

Test #3:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

3

output:

No

result:

ok OK, Accepted.

Test #4:

score: 0
Accepted
time: 1ms
memory: 3572kb

input:

4

output:

Yes
1 1 1 1
1 1 1 0
0 0 -1 -1
0 -1 -1 -1

result:

ok OK, Accepted.

Test #5:

score: 0
Accepted
time: 1ms
memory: 3604kb

input:

5

output:

No

result:

ok OK, Accepted.

Test #6:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

6

output:

Yes
1 1 1 1 1 1
1 1 1 1 1 0
1 1 1 1 0 0
0 0 0 -1 -1 -1
0 0 -1 -1 -1 -1
0 -1 -1 -1 -1 -1

result:

ok OK, Accepted.

Test #7:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

7

output:

No

result:

ok OK, Accepted.

Test #8:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

8

output:

Yes
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 0
1 1 1 1 1 1 0 0
1 1 1 1 1 0 0 0
0 0 0 0 -1 -1 -1 -1
0 0 0 -1 -1 -1 -1 -1
0 0 -1 -1 -1 -1 -1 -1
0 -1 -1 -1 -1 -1 -1 -1

result:

ok OK, Accepted.

Test #9:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

9

output:

No

result:

ok OK, Accepted.

Test #10:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

10

output:

Yes
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 0 0
1 1 1 1 1 1 1 0 0 0
1 1 1 1 1 1 0 0 0 0
0 0 0 0 0 -1 -1 -1 -1 -1
0 0 0 0 -1 -1 -1 -1 -1 -1
0 0 0 -1 -1 -1 -1 -1 -1 -1
0 0 -1 -1 -1 -1 -1 -1 -1 -1
0 -1 -1 -1 -1 -1 -1 -1 -1 -1

result:

ok OK, Accepted.

Test #11:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

21

output:

No

result:

ok OK, Accepted.

Test #12:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

37

output:

No

result:

ok OK, Accepted.

Test #13:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

73

output:

No

result:

ok OK, Accepted.

Test #14:

score: 0
Accepted
time: 1ms
memory: 4012kb

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
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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: 1ms
memory: 3552kb

input:

233

output:

No

result:

ok OK, Accepted.

Test #16:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

555

output:

No

result:

ok OK, Accepted.

Test #17:

score: 0
Accepted
time: 11ms
memory: 6160kb

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: 22ms
memory: 7108kb

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: 3608kb

input:

999

output:

No

result:

ok OK, Accepted.

Test #20:

score: 0
Accepted
time: 31ms
memory: 7592kb

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.