QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#114745#6189. Full Clue Problemstd_abs#AC ✓1ms3504kbC++201.4kb2023-06-23 13:46:052023-06-23 13:46:06

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-23 13:46:06]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3504kb
  • [2023-06-23 13:46:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define pii pair<int, int>
#define all(a) a.begin(), a.end()
#define sz(a) ((int)a.size())
const int mod = 1e9 + 7, N = 53, M = 200000;

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int n;
    cin >> n;
    vector <vector <int>> a(n, vector <int> (n));
    vector <vector <int>> b(n, vector <int> (n));
    vector <vector <int>> c(n, vector <int> (n));
    for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) {
        int d = abs(i - j);
        if (d <= 1) {
            a[i][j] = 2;
        }
        if (d == 2) {
            a[i][j] = 1;
        }
    }
    a[0][0] = a[n - 1][n - 1] = 3;
    b[0][0] = c[0][0] = 1;
    for (int i = 1; i < n; ++i) {
        if (i & 1) {
            b[i - 1][i] = b[i][i] = 1;
            c[i][i - 1] = c[i][i] = 1;
        } else {
            b[i][i - 1] = b[i][i] = 1;
            c[i - 1][i] = c[i][i] = 1;
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cout << a[i][j] << " \n"[j == n - 1];
        }
    }
    cout << '\n';
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cout << b[i][j] << " \n"[j == n - 1];
        }
    }
    cout << '\n';
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cout << c[i][j] << " \n"[j == n - 1];
        }
    }
}

详细

Test #1:

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

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

input:

2

output:

3 2
2 3

1 1
0 1

1 0
1 1

result:

ok ok

Test #3:

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

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

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

result:

ok ok

Test #6:

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

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

result:

ok ok

Test #7:

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

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

result:

ok ok