QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#307261 | #7629. Make SYSU Great Again II | 275307894a# | RE | 3ms | 8124kb | C++14 | 1.8kb | 2024-01-18 11:44:44 | 2024-01-18 11:44:45 |
Judging History
answer
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=2e3+5,M=N*4+5,K=(1<<25)+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(time(0));
int n,ans[N][N],k;
void paint1(int l,int r,int d,int op){
if(l>=r) return;
int m=l+r>>1;
for(int i=l;i<m;i++) for(int j=1;j<=n;j++) if(i+j+op&1) ans[i][j]|=1<<d;
for(int i=m+1;i<=r;i++) for(int j=1;j<=n;j++) if(~i+j+op&1) ans[i][j]|=1<<d;
paint1(l,m,d+1,0);paint1(m+1,r,d+1,1);
}
void paint2(int l,int r,int d,int op){
if(l>=r) return;
int m=l+r>>1;
for(int i=1;i<=n;i++) for(int j=l;j<m;j++) if(i+j+op&1) ans[i][j]|=1<<d;
for(int i=1;i<=n;i++) for(int j=m+1;j<=r;j++) if(~i+j+op&1) ans[i][j]|=1<<d;
paint2(l,m,d+1,0);paint2(m+1,r,d+1,1);
}
int ap[N*N*4];
void Solve(){
int i,j;scanf("%d",&n);k=__lg(n);
for(i=1;i<=n;i++){
for(j=1;j<=n;j++) if(i+j&1) ans[i][j]|=1;
}
paint1(1,n,1,0);
paint2(1,n,k+2,0);
for(i=1;i<=n;i++) for(j=1;j<n;j++) assert((ans[i][j]&ans[i][j+1])==0);
for(i=1;i<n;i++) for(j=1;j<=n;j++) assert((ans[i][j]&ans[i+1][j])==0);
for(i=1;i<=n;i++) for(j=1;j<=n;j++) assert(ans[i][j]>=0&&ans[i][j]<4*n*n),ap[ans[i][j]]++;
for(i=0;i<4*n*n;i++) assert(ap[i]<=5);
puts("Yes");
for(i=1;i<=n;i++) for(j=1;j<=n;j++) printf("%d%c",ans[i][j]," \n"[j==n]);
}
int main(){
int t=1;
// scanf("%d",&t);
while(t--) Solve();
cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5968kb
input:
4
output:
Yes 0 3 16 35 17 36 1 20 2 1 18 33 21 34 5 18
result:
ok 1
Test #2:
score: 0
Accepted
time: 1ms
memory: 5964kb
input:
1
output:
Yes 0
result:
ok 1
Test #3:
score: 0
Accepted
time: 1ms
memory: 6000kb
input:
2
output:
Yes 0 1 1 10
result:
ok 1
Test #4:
score: 0
Accepted
time: 1ms
memory: 6040kb
input:
3
output:
Yes 0 3 8 9 20 1 2 1 10
result:
ok 1
Test #5:
score: 0
Accepted
time: 1ms
memory: 5920kb
input:
5
output:
Yes 0 23 32 7 16 51 72 3 24 35 4 17 36 1 20 49 66 1 18 33 2 21 34 5 18
result:
ok 1
Test #6:
score: 0
Accepted
time: 1ms
memory: 5896kb
input:
8
output:
Yes 0 39 64 135 96 7 32 199 99 136 35 72 3 168 67 40 4 35 68 131 100 3 36 195 105 132 41 68 9 164 73 36 6 33 70 129 102 1 38 193 97 138 33 74 1 170 65 42 2 37 66 133 98 5 34 197 109 130 45 66 13 162 77 34
result:
ok 1
Test #7:
score: 0
Accepted
time: 1ms
memory: 6036kb
input:
13
output:
Yes 0 111 128 303 192 47 64 143 352 15 160 79 32 231 272 103 144 39 336 135 112 7 176 71 304 199 8 103 136 295 200 39 72 135 360 7 168 71 40 243 264 115 136 51 328 147 104 19 168 83 296 211 12 99 140 291 204 35 76 131 364 3 172 67 44 227 276 99 148 35 340 131 116 3 180 67 308 195 4 105 132 297 196 4...
result:
ok 1
Test #8:
score: 0
Accepted
time: 0ms
memory: 6056kb
input:
21
output:
Yes 0 479 512 223 1280 607 384 95 640 351 128 799 1216 31 448 543 320 159 576 415 64 975 1056 207 800 207 288 591 1440 79 160 783 224 271 736 15 352 655 1376 143 96 911 16 455 528 199 1296 583 400 71 656 327 144 775 1232 7 464 519 336 135 592 391 80 967 1048 199 792 199 280 583 1432 71 152 775 216 2...
result:
ok 1
Test #9:
score: 0
Accepted
time: 1ms
memory: 6044kb
input:
34
output:
Yes 0 1983 2048 959 1024 447 2560 1471 512 1215 2816 191 1280 703 2304 1727 256 3647 4480 575 1408 2111 1920 63 896 3135 640 319 1664 2367 1152 831 128 3903 3999 4160 927 1088 2463 1600 415 576 3231 832 159 1856 2207 1344 671 320 3615 448 1567 2496 543 1472 31 3008 1055 704 1311 2752 287 1216 799 22...
result:
ok 1
Test #10:
score: 0
Accepted
time: 0ms
memory: 6028kb
input:
55
output:
Yes 0 1983 2048 5055 3072 959 1024 2495 5632 447 2560 1471 4608 3263 768 1215 2816 4287 3840 191 1280 2751 5376 703 2304 1727 4352 3647 384 1599 2432 4671 3456 575 1408 2111 6016 63 2944 1087 4992 3135 640 1343 2688 4415 3712 319 1152 2879 5248 831 2176 1855 128 3999 4160 1951 2112 927 5184 2463 160...
result:
ok 1
Test #11:
score: 0
Accepted
time: 2ms
memory: 8124kb
input:
89
output:
Yes 0 8063 8192 3967 20480 10111 6144 1919 10240 6015 18432 13183 3072 4991 11264 895 23552 9087 5120 2943 9216 7039 1024 14719 17920 2431 13824 2431 5632 8575 24064 383 3584 12671 2560 5503 10752 1407 23040 9599 4608 3455 8704 7551 512 15487 17152 3199 13056 3199 4864 9343 23296 1151 2816 12415 384...
result:
ok 1
Test #12:
score: 0
Accepted
time: 0ms
memory: 5992kb
input:
100
output:
Yes 0 8063 8192 20351 12288 3967 4096 10111 22528 1919 10240 6015 2048 13183 19456 895 15360 895 5120 11135 21504 2943 9216 7039 1024 14719 17920 6527 9728 2431 22016 8575 7680 383 11776 4479 19968 12671 2560 5503 10752 1407 23040 9599 4608 3455 8704 7551 16896 15487 768 7295 8960 19583 13056 3199 4...
result:
ok 1
Test #13:
score: 0
Accepted
time: 3ms
memory: 6356kb
input:
200
output:
Yes 0 32511 32768 81663 49152 16127 16384 40703 90112 7935 40960 24319 8192 52991 77824 3839 61440 3839 20480 44799 86016 12031 36864 28415 4096 59135 71680 26367 38912 9983 88064 34559 30720 1791 47104 18175 79872 50943 10240 22271 43008 5887 92160 38655 18432 14079 34816 30463 67584 62207 3072 294...
result:
ok 1
Test #14:
score: -100
Runtime Error
input:
300