QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#97728#6189. Full Clue Problemcardinal_city#AC ✓3ms3480kbC++201.0kb2023-04-18 01:30:512023-04-18 01:30:54

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-18 01:30:54]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3480kb
  • [2023-04-18 01:30:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

void pg(vector<vector<int>> &g, int n) {
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << g[i][j] << ' ';
        }
        cout << '\n';
    }
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int n; cin >> n;

    vector<vector<int>> grid(n+2, vector<int>(n+2)), s1(n+2, vector<int>(n+2)), s2(n+2, vector<int>(n+2));
    for (int i = 0; i < n; i++) {
        s1[i][i] = s2[i][i] = 1;
        if (i == 0 || i == n-1) {
            grid[i][i] = 3;
        } else {
            grid[i][i] = 2;
            grid[i-1][i+1] = grid[i+1][i-1] = 1;
        }
        if (i == n-1) continue;

        grid[i+1][i] = grid[i][i+1] = 2;

        if (i % 2) {
            s1[i+1][i] = 1;
            s2[i][i+1] = 1;
        } else {
            s1[i][i+1] = 1;
            s2[i+1][i] = 1;
        }
    }

    pg(grid, n);
    cout << '\n';
    pg(s1, n);
    cout << '\n';
    pg(s2, n);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3428kb

input:

5

output:

3 2 1 0 0 
2 2 2 1 0 
1 2 2 2 1 
0 1 2 2 2 
0 0 1 2 3 

1 1 0 0 0 
0 1 0 0 0 
0 1 1 1 0 
0 0 0 1 0 
0 0 0 1 1 

1 0 0 0 0 
1 1 1 0 0 
0 0 1 0 0 
0 0 1 1 1 
0 0 0 0 1 

result:

ok ok

Test #2:

score: 0
Accepted
time: 2ms
memory: 3448kb

input:

2

output:

3 2 
2 3 

1 1 
0 1 

1 0 
1 1 

result:

ok ok

Test #3:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

3

output:

3 2 1 
2 2 2 
1 2 3 

1 1 0 
0 1 0 
0 1 1 

1 0 0 
1 1 1 
0 0 1 

result:

ok ok

Test #4:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

4

output:

3 2 1 0 
2 2 2 1 
1 2 2 2 
0 1 2 3 

1 1 0 0 
0 1 0 0 
0 1 1 1 
0 0 0 1 

1 0 0 0 
1 1 1 0 
0 0 1 0 
0 0 1 1 

result:

ok ok

Test #5:

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

input:

10

output:

3 2 1 0 0 0 0 0 0 0 
2 2 2 1 0 0 0 0 0 0 
1 2 2 2 1 0 0 0 0 0 
0 1 2 2 2 1 0 0 0 0 
0 0 1 2 2 2 1 0 0 0 
0 0 0 1 2 2 2 1 0 0 
0 0 0 0 1 2 2 2 1 0 
0 0 0 0 0 1 2 2 2 1 
0 0 0 0 0 0 1 2 2 2 
0 0 0 0 0 0 0 1 2 3 

1 1 0 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 0 
0 1 1 1 0 0 0 0 0 0 
0 0 0 1 0 0 0 0 0 0 
0 0 0...

result:

ok ok

Test #6:

score: 0
Accepted
time: 3ms
memory: 3440kb

input:

19

output:

3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 1 2 2 2 1 0 0 0 0...

result:

ok ok

Test #7:

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

input:

20

output:

3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 1 2...

result:

ok ok