QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#508254#6189. Full Clue ProblemchimeraAC ✓0ms3600kbC++141.8kb2024-08-07 11:42:592024-08-07 11:42:59

Judging History

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

  • [2024-08-07 11:42:59]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3600kb
  • [2024-08-07 11:42:59]
  • 提交

answer

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


int A[3][2][2] = {{{3,2},{2,3}}, {{1,1},{0,1}}, {{1,0},{1,1}}};

int main() {
    int N; cin >> N;
    vector<vector<int>> M(N, vector<int>(N));
    vector<int> steps;
    steps.push_back(1);
    for(ll i = 0; i < N-2; i++) steps.push_back(2);
    steps.push_back(1);

    ll x = 0, y = 0;
    while(steps.size()) {
        auto b = steps.back(); steps.pop_back();

        while(b--) {M[x][y]=1; x++;}

        if(steps.size()) {
            auto b = steps.back(); steps.pop_back();
            while(b--) {M[x][y]=1; y++;}
        }
    }
    M[x][y]=1;


    vector<vector<int>> A(N, vector<int>(N, 0));
    for(ll i = 0; i < N; i++) {
        for(ll j = 0; j < N; j++) {
            ll ct = 0;
            for(ll di = -1; di < 2; di++) {
                for(ll dj = -1; dj < 2; dj++) {
                    if(!(di || dj)) continue;
                    if(di && dj) continue;

                    ll i2 = i+di, j2 = j+dj;

                    if((i2 < 0) || (i2 >= N) || (j2 < 0 )|| (j2 >= N)) {
                        if(M[i][j]) ct++;
                        continue;
                    }
                    if((M[i2][j2] != M[i][j])) ct++;
                }
            }
            A[i][j] = ct;
        }
    }

    for(ll i = 0; i < N; i++) {
        for(ll j = 0; j < N; j++)
            cout << A[i][j] << " ";
        cout << "\n";
    }
    cout << "\n";

    for(ll i = 0; i < N; i++) {
        for(ll j = 0; j < N; j++)
            cout << M[i][j] << " ";
        cout << "\n";
    }
    cout << "\n";
    for(ll j = 0; j < N; j++) {
        for(ll i = 0; i < N; i++)
            cout << M[i][j] << " ";
        cout << "\n";
    }
    
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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

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

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

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

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

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