QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#121790#6189. Full Clue ProblemUndertrainedOverpressure#AC ✓1ms3500kbC++231.9kb2023-07-08 20:53:192023-07-08 20:53:22

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-08 20:53:22]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3500kb
  • [2023-07-08 20:53:19]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define TIME (clock() * 1.0 / CLOCKS_PER_SEC)

void solve() {
    int n;
    cin >> n;
    if (n == 2) {
        cout << "2 3\n" \
                "3 2\n" \
                "\n" \
                "1 1\n" \
                "1 0\n" \
                "\n" \
                "0 1\n" \
                "1 1\n";
        return;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == 0 && j == 0) {
                cout << "3 ";
                continue;
            }
            if (i == n - 1 && 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";
    }
    cout << "\n";

    vector<vector<int>> ans(n, vector<int>(n, 0));
    auto add = [&](int i, int j) {
        if (i < n && j < n) {
            ans[i][j] = 1;
        }
    };
    int x = 0;
    int y = 0;
    for (int i = 0; i < n; i++) {
        add(x, y);
        add(x + 1, y);
        add(x + 1, y + 1);
        add(x + 1, y + 2);
        x += 2;
        y += 2;
    }

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

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

int main() {
#ifdef ONPC
    freopen("input", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

input:

2

output:

2 3
3 2

1 1
1 0

0 1
1 1

result:

ok ok

Test #3:

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

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

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

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

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

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