QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#558894#6189. Full Clue Problempandapythoner#AC ✓0ms3868kbC++232.0kb2024-09-11 19:10:532024-09-11 19:10:53

Judging History

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

  • [2024-09-11 19:10:53]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3868kb
  • [2024-09-11 19:10:53]
  • 提交

answer

#include <bits/stdc++.h>


using namespace std;

using ll = long long;
using ld = long double;

#define len(a) ((int)(a).size())
#define rep(i, n) for(int i = 0; i < (n); i += 1)


mt19937 rnd(234);


int32_t main() {
    if (1) {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }
    int n;
    cin >> n;
    rep(i, n) {
        rep(j, n) {
            if (i == 0 and j == 0) {
                cout << 3 << " ";
                continue;
            }
            if (i == n - 1 and j == n - 1) {
                cout << 3 << " ";
                continue;
            }
            if (abs(i - j) <= 1) {
                cout << 2 << " ";
                continue;
            }
            if (abs(i - j) == 2) {
                cout << 1 << " ";
                continue;
            }
            cout << 0 << " ";
        }
        cout << "\n";
    }
    vector<vector<int>> a(n, vector<int>(n, 0));
    int x = 0, y = 0;
    a[x][y] = 1;
    ++x;
    a[x][y] = 1;
    int dir = 1;
    while (1) {
        if (dir == 0) {
            if (x + 2 < n) {
                ++x;
                a[x][y] = 1;
                ++x;
                a[x][y] = 1;
            } else {
                assert(x + 1 < n);
                ++x;
                a[x][y] = 1;
                break;
            }
        } else {
            if (y + 2 < n) {
                ++y;
                a[x][y] = 1;
                ++y;
                a[x][y] = 1;
            } else {
                assert(y + 1 < n);
                ++y;
                a[x][y] = 1;
                break;
            }
        }
        dir ^= 1;
    }
    assert(x == n - 1 and y == n - 1);
    cout << "\n";
    rep(i, n) {
        rep(j, n) {
            cout << a[i][j] << " ";
        }
        cout << "\n";
    }
    cout << "\n";
    rep(i, n) {
        rep(j, n) {
            cout << a[j][i] << " ";
        }
        cout << "\n";
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

result:

ok ok

Test #2:

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

input:

2

output:

3 2 
2 3 

1 0 
1 1 

1 1 
0 1 

result:

ok ok

Test #3:

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

input:

3

output:

3 2 1 
2 2 2 
1 2 3 

1 0 0 
1 1 1 
0 0 1 

1 1 0 
0 1 0 
0 1 1 

result:

ok ok

Test #4:

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

input:

4

output:

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

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

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

result:

ok ok

Test #5:

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

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

result:

ok ok

Test #6:

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

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

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