QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#642641#8474. Matrices and Sumsucup-team3519#AC ✓32ms7116kbC++171020b2024-10-15 15:26:492024-10-15 15:26:50

Judging History

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

  • [2024-10-15 15:26:50]
  • 评测
  • 测评结果:AC
  • 用时:32ms
  • 内存:7116kb
  • [2024-10-15 15:26:49]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define V vector
#define pb push_back
#define all1(x) (x).begin() + 1, (x).end()

mt19937 mrand(chrono::steady_clock().now().time_since_epoch().count());


void solve() {
    int n; cin >> n;
    if(n & 1) {
        cout << "No" << endl;
        return;
    }
    cout << "Yes" << endl;
    V<V<int>> ans(n + 1, V<int>(n + 1));
    for(int i = 1;i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            if(i + j <= n + 1) ans[i][j] = 1;
            else ans[i][j] = -1;
            if(i + j == n + 1) {
                if(i <= n / 2) ans[i][j] = 1;
                else ans[i][j] = 0;
            } else if(i == j){
                if(i <= n / 2) ans[i][j] = 1;
                else ans[i][j] = -1;
            }
        }
    }

    for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) cout << ans[i][j] << " \n"[j == n];
    
}


int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    // int t; cin >> t;
    solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3844kb

input:

2

output:

Yes
1 1
0 -1

result:

ok OK, Accepted.

Test #2:

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

input:

1

output:

No

result:

ok OK, Accepted.

Test #3:

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

input:

3

output:

No

result:

ok OK, Accepted.

Test #4:

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

input:

4

output:

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

result:

ok OK, Accepted.

Test #5:

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

input:

5

output:

No

result:

ok OK, Accepted.

Test #6:

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

input:

6

output:

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

result:

ok OK, Accepted.

Test #7:

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

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
1 1 1 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 0 -1 -1 -1 -1 -1
1 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: 3584kb

input:

9

output:

No

result:

ok OK, Accepted.

Test #10:

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

input:

10

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

input:

21

output:

No

result:

ok OK, Accepted.

Test #12:

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

input:

37

output:

No

result:

ok OK, Accepted.

Test #13:

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

input:

73

output:

No

result:

ok OK, Accepted.

Test #14:

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

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: 0ms
memory: 3560kb

input:

233

output:

No

result:

ok OK, Accepted.

Test #16:

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

input:

555

output:

No

result:

ok OK, Accepted.

Test #17:

score: 0
Accepted
time: 15ms
memory: 5080kb

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

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

input:

999

output:

No

result:

ok OK, Accepted.

Test #20:

score: 0
Accepted
time: 32ms
memory: 7116kb

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.