QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202522#6189. Full Clue Problemucup-team870#AC ✓1ms3920kbC++141.3kb2023-10-06 10:56:312023-10-06 10:56:32

Judging History

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

  • [2023-10-06 10:56:32]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3920kb
  • [2023-10-06 10:56:31]
  • 提交

answer

#include <bits/stdc++.h>
#define For(i,l,r) for(int i=l; i<=r; i++)
#define IOS {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);}
using namespace std;
int ca[25][25],cb[25][25];
int a[25][25],b[25][25];
int main(){
    int n; cin>>n;
    For(i,1,n) ca[i][i]=cb[i][i]=1;
    //ca
    for(int i=2;i<=n;i+=2){
        ca[i][i-1]=1;
        if (i+1<=n) ca[i][i+1]=1;
    }
    //cb
    for(int i=2;i<=n;i+=2){
        cb[i-1][i]=1;
        if (i+1<=n) cb[i+1][i]=1;
    }
    //a
    For(i,1,n) For(j,1,n){
        if (ca[i][j]!=ca[i-1][j]) ++a[i][j];
        if (ca[i][j]!=ca[i+1][j]) ++a[i][j];
        if (ca[i][j]!=ca[i][j-1]) ++a[i][j];
        if (ca[i][j]!=ca[i][j+1]) ++a[i][j];
    }
    //b
    For(i,1,n) For(j,1,n){
        if (cb[i][j]!=cb[i-1][j]) ++b[i][j];
        if (cb[i][j]!=cb[i+1][j]) ++b[i][j];
        if (cb[i][j]!=cb[i][j-1]) ++b[i][j];
        if (cb[i][j]!=cb[i][j+1]) ++b[i][j];
    }
    //check
    For(i,1,n) For(j,1,n) if (a[i][j]!=b[i][j]) exit(55466646);
    //print
    For(i,1,n){
        For(j,1,n) printf("%d ",a[i][j]);
        printf("\n");
    }
    printf("\n");
    For(i,1,n){
        For(j,1,n) printf("%d ",ca[i][j]);
        printf("\n");
    }
    printf("\n");
    For(i,1,n){
        For(j,1,n) printf("%d ",cb[i][j]);
        printf("\n");
    }
}

详细

Test #1:

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

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

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

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

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

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

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

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