QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#34591 | #2598. Permutation Matrix | yzhang | AC ✓ | 83ms | 5712kb | C++17 | 725b | 2022-06-11 11:37:51 | 2022-06-11 11:37:54 |
Judging History
answer
#include<cstdio>
int n,N,D,c=1,v[1<<10][1<<10];
void set(int x,int y,int z){v[x][y]=z;}
void set(int x,int y)
{
set(x,y,c);
set(x+D,y,c+1);
set(x,y+D,c+2);
set(x+D,y+D,c+3);
set(x,y+1,c+5);
set(x+D,y+1,c+4);
set(x,y+D+1,c+7);
set(x+D,y+D+1,c+6);
set(x+1,y,c+10);
set(x+D+1,y,c+11);
set(x+1,y+D,c+8);
set(x+D+1,y+D,c+9);
set(x+1,y+1,c+15);
set(x+D+1,y+1,c+14);
set(x+1,y+D+1,c+13);
set(x+D+1,y+D+1,c+12);
c+=16;
}
int main()
{
scanf("%d",&n),N=(1<<n),D=N>>1;
if(n==1)puts("NO");
else
{
puts("YES");
for(int i=0;i<D;i+=2)
for(int ii=0;ii<D;ii+=2)
set(i,ii);
for(int i=0;i<N;i++,puts(""))
for(int ii=0;ii<N;ii++)
printf("%d ",v[i][ii]);
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 1960kb
input:
1
output:
NO
result:
ok OK.
Test #2:
score: 0
Accepted
time: 1ms
memory: 1696kb
input:
2
output:
YES 1 6 3 8 11 16 9 14 2 5 4 7 12 15 10 13
result:
ok OK.
Test #3:
score: 0
Accepted
time: 1ms
memory: 1688kb
input:
3
output:
YES 1 6 17 22 3 8 19 24 11 16 27 32 9 14 25 30 33 38 49 54 35 40 51 56 43 48 59 64 41 46 57 62 2 5 18 21 4 7 20 23 12 15 28 31 10 13 26 29 34 37 50 53 36 39 52 55 44 47 60 63 42 45 58 61
result:
ok OK.
Test #4:
score: 0
Accepted
time: 1ms
memory: 1732kb
input:
4
output:
YES 1 6 17 22 33 38 49 54 3 8 19 24 35 40 51 56 11 16 27 32 43 48 59 64 9 14 25 30 41 46 57 62 65 70 81 86 97 102 113 118 67 72 83 88 99 104 115 120 75 80 91 96 107 112 123 128 73 78 89 94 105 110 121 126 129 134 145 150 161 166 177 182 131 136 147 152 163 168 179 184 139 144 155 160 171 176 18...
result:
ok OK.
Test #5:
score: 0
Accepted
time: 2ms
memory: 3784kb
input:
5
output:
YES 1 6 17 22 33 38 49 54 65 70 81 86 97 102 113 118 3 8 19 24 35 40 51 56 67 72 83 88 99 104 115 120 11 16 27 32 43 48 59 64 75 80 91 96 107 112 123 128 9 14 25 30 41 46 57 62 73 78 89 94 105 110 121 126 129 134 145 150 161 166 177 182 193 198 209 214 225 230 241 246 131 136 147 152 163 168 179 1...
result:
ok OK.
Test #6:
score: 0
Accepted
time: 0ms
memory: 1880kb
input:
6
output:
YES 1 6 17 22 33 38 49 54 65 70 81 86 97 102 113 118 129 134 145 150 161 166 177 182 193 198 209 214 225 230 241 246 3 8 19 24 35 40 51 56 67 72 83 88 99 104 115 120 131 136 147 152 163 168 179 184 195 200 211 216 227 232 243 248 11 16 27 32 43 48 59 64 75 80 91 96 107 112 123 128 139 144 155 160 1...
result:
ok OK.
Test #7:
score: 0
Accepted
time: 3ms
memory: 3808kb
input:
7
output:
YES 1 6 17 22 33 38 49 54 65 70 81 86 97 102 113 118 129 134 145 150 161 166 177 182 193 198 209 214 225 230 241 246 257 262 273 278 289 294 305 310 321 326 337 342 353 358 369 374 385 390 401 406 417 422 433 438 449 454 465 470 481 486 497 502 3 8 19 24 35 40 51 56 67 72 83 88 99 104 115 120 131 13...
result:
ok OK.
Test #8:
score: 0
Accepted
time: 8ms
memory: 2724kb
input:
8
output:
YES 1 6 17 22 33 38 49 54 65 70 81 86 97 102 113 118 129 134 145 150 161 166 177 182 193 198 209 214 225 230 241 246 257 262 273 278 289 294 305 310 321 326 337 342 353 358 369 374 385 390 401 406 417 422 433 438 449 454 465 470 481 486 497 502 513 518 529 534 545 550 561 566 577 582 593 598 609 614...
result:
ok OK.
Test #9:
score: 0
Accepted
time: 20ms
memory: 3796kb
input:
9
output:
YES 1 6 17 22 33 38 49 54 65 70 81 86 97 102 113 118 129 134 145 150 161 166 177 182 193 198 209 214 225 230 241 246 257 262 273 278 289 294 305 310 321 326 337 342 353 358 369 374 385 390 401 406 417 422 433 438 449 454 465 470 481 486 497 502 513 518 529 534 545 550 561 566 577 582 593 598 609 614...
result:
ok OK.
Test #10:
score: 0
Accepted
time: 83ms
memory: 5712kb
input:
10
output:
YES 1 6 17 22 33 38 49 54 65 70 81 86 97 102 113 118 129 134 145 150 161 166 177 182 193 198 209 214 225 230 241 246 257 262 273 278 289 294 305 310 321 326 337 342 353 358 369 374 385 390 401 406 417 422 433 438 449 454 465 470 481 486 497 502 513 518 529 534 545 550 561 566 577 582 593 598 609 614...
result:
ok OK.