QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#307262#7629. Make SYSU Great Again II275307894a#AC ✓315ms37436kbC++141.8kb2024-01-18 11:45:432024-01-18 11:45:43

Judging History

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

  • [2024-01-18 11:45:43]
  • 评测
  • 测评结果:AC
  • 用时:315ms
  • 内存:37436kb
  • [2024-01-18 11:45:43]
  • 提交

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+1>=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';
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4

output:

Yes
0 3 16 3
17 4 1 20
2 1 18 1
21 2 5 18

result:

ok 1

Test #2:

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

input:

1

output:

Yes
0

result:

ok 1

Test #3:

score: 0
Accepted
time: 0ms
memory: 6012kb

input:

2

output:

Yes
0 1
1 2

result:

ok 1

Test #4:

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

input:

3

output:

Yes
0 3 8
9 4 1
2 1 10

result:

ok 1

Test #5:

score: 0
Accepted
time: 0ms
memory: 6012kb

input:

5

output:

Yes
0 23 32 7 16
51 8 3 24 3
4 17 36 1 20
49 2 1 18 1
2 21 34 5 18

result:

ok 1

Test #6:

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

input:

8

output:

Yes
0 39 64 7 96 7 32 71
99 8 35 72 3 40 67 40
4 35 68 3 100 3 36 67
105 4 41 68 9 36 73 36
6 33 70 1 102 1 38 65
97 10 33 74 1 42 65 42
2 37 66 5 98 5 34 69
109 2 45 66 13 34 77 34

result:

ok 1

Test #7:

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

input:

13

output:

Yes
0 111 128 47 192 47 64 143 96 15 160 79 32
231 16 103 144 39 80 135 112 7 176 71 48 199
8 103 136 39 200 39 72 135 104 7 168 71 40
243 8 115 136 51 72 147 104 19 168 83 40 211
12 99 140 35 204 35 76 131 108 3 172 67 44
227 20 99 148 35 84 131 116 3 180 67 52 195
4 105 132 41 196 41 68 137 100 9 ...

result:

ok 1

Test #8:

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

input:

21

output:

Yes
0 479 512 223 256 607 384 95 640 351 128 799 192 31 448 31 320 159 576 415 64
975 32 207 800 207 288 591 416 79 160 271 224 271 736 15 352 655 352 143 96 399
16 455 528 199 272 583 400 71 656 327 144 775 208 7 464 7 336 135 592 391 80
967 24 199 792 199 280 583 408 71 152 263 216 263 728 7 344 6...

result:

ok 1

Test #9:

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

input:

34

output:

Yes
0 1983 2048 959 1024 447 512 1471 512 1215 768 191 1280 703 256 1727 256 3647 384 575 1408 63 1920 63 896 1087 640 319 1664 319 1152 831 128 1855
3999 64 927 1088 415 1600 415 576 1183 832 159 1856 159 1344 671 320 1567 448 1567 2496 543 1472 31 960 1055 704 1311 704 287 1216 799 192 1823 192
32...

result:

ok 1

Test #10:

score: 0
Accepted
time: 2ms
memory: 8012kb

input:

55

output:

Yes
0 1983 2048 959 3072 959 1024 2495 1536 447 2560 1471 512 3263 768 1215 2816 191 3840 191 1280 2751 1280 703 2304 1727 256 3647 384 1599 2432 575 3456 575 1408 2111 1920 63 2944 1087 896 3135 640 1343 2688 319 3712 319 1152 2879 1152 831 2176 1855 128
3999 64 1951 2112 927 1088 2463 1600 415 364...

result:

ok 1

Test #11:

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

input:

89

output:

Yes
0 8063 8192 3967 4096 10111 6144 1919 10240 6015 2048 13183 3072 4991 11264 895 7168 9087 5120 2943 9216 7039 1024 14719 1536 2431 13824 2431 5632 8575 7680 383 3584 4479 2560 5503 10752 1407 6656 9599 4608 3455 8704 7551 512 15487 768 3199 13056 3199 4864 9343 6912 1151 2816 4223 3840 4223 1203...

result:

ok 1

Test #12:

score: 0
Accepted
time: 0ms
memory: 8120kb

input:

100

output:

Yes
0 8063 8192 3967 12288 3967 4096 10111 6144 1919 10240 6015 2048 13183 3072 895 15360 895 5120 11135 5120 2943 9216 7039 1024 14719 1536 6527 9728 2431 5632 8575 7680 383 11776 4479 3584 12671 2560 5503 10752 1407 6656 9599 4608 3455 8704 7551 512 15487 768 7295 8960 3199 13056 3199 4864 9343 69...

result:

ok 1

Test #13:

score: 0
Accepted
time: 2ms
memory: 6308kb

input:

200

output:

Yes
0 32511 32768 16127 49152 16127 16384 40703 24576 7935 40960 24319 8192 52991 12288 3839 61440 3839 20480 44799 20480 12031 36864 28415 4096 59135 6144 26367 38912 9983 22528 34559 30720 1791 47104 18175 14336 50943 10240 22271 43008 5887 26624 38655 18432 14079 34816 30463 2048 62207 3072 29439...

result:

ok 1

Test #14:

score: 0
Accepted
time: 8ms
memory: 10256kb

input:

300

output:

Yes
0 130559 131072 65023 65536 163327 98304 32255 32768 81407 49152 81407 180224 15871 81920 48639 16384 114175 16384 237055 24576 40447 90112 7679 122880 7679 188416 73215 40960 220671 40960 24063 106496 24063 73728 56831 8192 118271 12288 118271 143360 52735 77824 151039 110592 19967 45056 69119 ...

result:

ok 1

Test #15:

score: 0
Accepted
time: 12ms
memory: 11112kb

input:

400

output:

Yes
0 130559 131072 65023 196608 65023 65536 163327 98304 32255 163840 97791 32768 212479 49152 15871 245760 15871 81920 179711 81920 48639 147456 114175 16384 237055 24576 105983 155648 40447 90112 138751 122880 7679 188416 73215 57344 204287 40960 89599 172032 24063 106496 155135 73728 56831 13926...

result:

ok 1

Test #16:

score: 0
Accepted
time: 14ms
memory: 11132kb

input:

500

output:

Yes
0 130559 131072 65023 196608 65023 65536 163327 98304 32255 229376 32255 163840 97791 32768 212479 49152 81407 180224 15871 245760 15871 114688 146943 81920 48639 212992 48639 147456 114175 16384 237055 24576 105983 155648 40447 221184 40447 90112 138751 122880 7679 253952 7679 188416 73215 5734...

result:

ok 1

Test #17:

score: 0
Accepted
time: 23ms
memory: 16216kb

input:

600

output:

Yes
0 523263 524288 261119 262144 654335 393216 130047 131072 326655 196608 326655 720896 64511 327680 195583 65536 457727 65536 949247 98304 162815 360448 31743 491520 31743 753664 293887 163840 883711 163840 97279 425984 97279 294912 228351 32768 474111 49152 474111 573440 211967 311296 605183 442...

result:

ok 1

Test #18:

score: 0
Accepted
time: 29ms
memory: 16640kb

input:

700

output:

Yes
0 523263 524288 261119 262144 654335 393216 130047 655360 392191 131072 850943 196608 64511 983040 64511 327680 719871 327680 195583 65536 424959 98304 424959 622592 162815 360448 556031 491520 31743 753664 293887 163840 883711 163840 97279 950272 97279 294912 752639 294912 228351 32768 474111 4...

result:

ok 1

Test #19:

score: 0
Accepted
time: 45ms
memory: 16248kb

input:

800

output:

Yes
0 523263 524288 261119 786432 261119 262144 654335 393216 130047 655360 392191 131072 850943 196608 64511 983040 64511 327680 719871 327680 195583 589824 457727 65536 949247 98304 424959 622592 162815 360448 556031 491520 31743 753664 293887 229376 818175 163840 359423 688128 97279 425984 621567...

result:

ok 1

Test #20:

score: 0
Accepted
time: 76ms
memory: 16932kb

input:

900

output:

Yes
0 523263 524288 261119 786432 261119 262144 654335 393216 130047 917504 130047 655360 392191 131072 850943 196608 326655 720896 64511 458752 588799 327680 195583 851968 195583 589824 457727 65536 949247 98304 424959 622592 162815 360448 556031 491520 31743 1015808 31743 753664 293887 163840 8837...

result:

ok 1

Test #21:

score: 0
Accepted
time: 54ms
memory: 19768kb

input:

1000

output:

Yes
0 523263 524288 261119 786432 261119 262144 654335 393216 130047 917504 130047 655360 392191 131072 850943 196608 326655 720896 64511 983040 64511 458752 588799 327680 195583 851968 195583 589824 457727 65536 949247 98304 424959 622592 162815 884736 162815 360448 556031 491520 31743 1015808 3174...

result:

ok 1

Test #22:

score: 0
Accepted
time: 102ms
memory: 34680kb

input:

1200

output:

Yes
0 2095103 2097152 1046527 1048576 2619391 1572864 522239 524288 1308671 786432 1308671 2883584 260095 1310720 784383 262144 1832959 262144 3799039 393216 653311 1441792 129023 1966080 129023 3014656 1177599 655360 3536895 655360 391167 1703936 391167 1179648 915455 131072 1898495 196608 1898495 ...

result:

ok 1

Test #23:

score: 0
Accepted
time: 144ms
memory: 33616kb

input:

1400

output:

Yes
0 2095103 2097152 1046527 1048576 2619391 1572864 522239 2621440 1570815 524288 3405823 786432 260095 3932160 260095 1310720 2881535 1310720 784383 262144 1701887 393216 1701887 2490368 653311 1441792 2226175 1966080 129023 3014656 1177599 655360 3536895 655360 391167 3801088 391167 1179648 3012...

result:

ok 1

Test #24:

score: 0
Accepted
time: 197ms
memory: 34984kb

input:

1600

output:

Yes
0 2095103 2097152 1046527 3145728 1046527 1048576 2619391 1572864 522239 2621440 1570815 524288 3405823 786432 260095 3932160 260095 1310720 2881535 1310720 784383 2359296 1832959 262144 3799039 393216 1701887 2490368 653311 1441792 2226175 1966080 129023 3014656 1177599 917504 3274751 655360 14...

result:

ok 1

Test #25:

score: 0
Accepted
time: 260ms
memory: 35872kb

input:

1800

output:

Yes
0 2095103 2097152 1046527 3145728 1046527 1048576 2619391 1572864 522239 3670016 522239 2621440 1570815 524288 3405823 786432 1308671 2883584 260095 1835008 2357247 1310720 784383 3407872 784383 2359296 1832959 262144 3799039 393216 1701887 2490368 653311 1441792 2226175 1966080 129023 4063232 1...

result:

ok 1

Test #26:

score: 0
Accepted
time: 268ms
memory: 37364kb

input:

1900

output:

Yes
0 2095103 2097152 1046527 3145728 1046527 1048576 2619391 1572864 522239 3670016 522239 2621440 1570815 524288 3405823 786432 1308671 2883584 260095 1835008 2357247 1310720 2881535 1310720 784383 2359296 1832959 262144 3799039 393216 1701887 2490368 653311 3538944 653311 1441792 2226175 1966080 ...

result:

ok 1

Test #27:

score: 0
Accepted
time: 301ms
memory: 37412kb

input:

1920

output:

Yes
0 2095103 2097152 1046527 3145728 1046527 1048576 2619391 1572864 522239 3670016 522239 2621440 1570815 524288 3405823 786432 1308671 2883584 260095 1835008 2357247 1310720 2881535 1310720 784383 2359296 1832959 262144 3799039 393216 1701887 2490368 653311 3538944 653311 1441792 2226175 1966080 ...

result:

ok 1

Test #28:

score: 0
Accepted
time: 315ms
memory: 37436kb

input:

2000

output:

Yes
0 2095103 2097152 1046527 3145728 1046527 1048576 2619391 1572864 522239 3670016 522239 2621440 1570815 524288 3405823 786432 1308671 2883584 260095 3932160 260095 1835008 2357247 1310720 784383 3407872 784383 2359296 1832959 262144 3799039 393216 1701887 2490368 653311 3538944 653311 1441792 22...

result:

ok 1

Test #29:

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

input:

62

output:

Yes
0 1983 2048 959 3072 959 1024 2495 1536 447 3584 447 2560 1471 512 3263 768 1215 2816 191 3840 191 1792 2239 1280 703 3328 703 2304 1727 256 3647 384 1599 2432 575 1408 2623 1408 2111 1920 63 2944 1087 896 3135 640 3391 640 1343 2688 319 1664 2367 1152 2879 1152 831 2176 1855 128 3903
3999 64 19...

result:

ok 1

Test #30:

score: 0
Accepted
time: 2ms
memory: 6148kb

input:

130

output:

Yes
0 32511 32768 16127 16384 7935 8192 24319 8192 20223 12288 3839 20480 12031 4096 28415 4096 26367 6144 9983 22528 1791 14336 18175 10240 22271 10240 5887 18432 14079 2048 30463 2048 29439 3072 13055 19456 4863 11264 21247 11264 17151 15360 767 23552 8959 7168 25343 5120 27391 5120 11007 21504 28...

result:

ok 1

Test #31:

score: 0
Accepted
time: 2ms
memory: 10128kb

input:

126

output:

Yes
0 8063 8192 3967 12288 3967 4096 10111 6144 1919 14336 1919 10240 6015 2048 13183 3072 4991 11264 895 15360 895 7168 9087 5120 2943 13312 2943 9216 7039 1024 14719 1536 6527 9728 2431 13824 2431 5632 8575 7680 383 15872 383 11776 4479 3584 12671 2560 5503 10752 1407 14848 1407 6656 9599 4608 345...

result:

ok 1

Test #32:

score: 0
Accepted
time: 0ms
memory: 5936kb

input:

66

output:

Yes
0 8063 8192 3967 4096 1919 2048 6015 2048 4991 3072 895 5120 2943 1024 7039 1024 6527 1536 2431 5632 383 3584 4479 2560 5503 2560 1407 4608 3455 512 7551 512 15487 768 3199 4864 1151 6912 1151 2816 4223 3840 127 7936 127 5888 2175 1792 6271 1280 2687 5376 639 7424 639 3328 4735 2304 1663 6400 16...

result:

ok 1

Test #33:

score: 0
Accepted
time: 64ms
memory: 19360kb

input:

1021

output:

Yes
0 523263 524288 261119 786432 261119 262144 654335 393216 130047 917504 130047 655360 392191 131072 850943 196608 326655 720896 64511 983040 64511 458752 588799 327680 195583 851968 195583 589824 457727 65536 949247 98304 424959 622592 162815 884736 162815 360448 556031 491520 31743 1015808 3174...

result:

ok 1

Test #34:

score: 0
Accepted
time: 77ms
memory: 19236kb

input:

1022

output:

Yes
0 523263 524288 261119 786432 261119 262144 654335 393216 130047 917504 130047 655360 392191 131072 850943 196608 326655 720896 64511 983040 64511 458752 588799 327680 195583 851968 195583 589824 457727 65536 949247 98304 424959 622592 162815 884736 162815 360448 556031 491520 31743 1015808 3174...

result:

ok 1

Test #35:

score: 0
Accepted
time: 72ms
memory: 18636kb

input:

1023

output:

Yes
0 523263 524288 261119 786432 261119 262144 654335 393216 130047 917504 130047 655360 392191 131072 850943 196608 326655 720896 64511 983040 64511 458752 588799 327680 195583 851968 195583 589824 457727 65536 949247 98304 424959 622592 162815 884736 162815 360448 556031 491520 31743 1015808 3174...

result:

ok 1

Test #36:

score: 0
Accepted
time: 68ms
memory: 22720kb

input:

1024

output:

Yes
0 1045503 1048576 521215 1572864 521215 524288 1307647 786432 259071 1835008 259071 1310720 783359 262144 1700863 393216 652287 1441792 127999 1966080 127999 917504 1176575 655360 390143 1703936 390143 1179648 914431 131072 1897471 196608 848895 1245184 324607 1769472 324607 720896 1111039 98304...

result:

ok 1

Test #37:

score: 0
Accepted
time: 70ms
memory: 24680kb

input:

1025

output:

Yes
0 2095103 2097152 1046527 1048576 522239 524288 1570815 524288 1308671 786432 260095 1310720 784383 262144 1832959 262144 1701887 393216 653311 1441792 129023 917504 1177599 655360 1439743 655360 391167 1179648 915455 131072 1964031 131072 1898495 196608 849919 1245184 325631 720896 1374207 7208...

result:

ok 1

Test #38:

score: 0
Accepted
time: 97ms
memory: 24944kb

input:

1026

output:

Yes
0 2095103 2097152 1046527 1048576 522239 524288 1570815 524288 1308671 786432 260095 1310720 784383 262144 1832959 262144 1701887 393216 653311 1441792 129023 917504 1177599 655360 1439743 655360 391167 1179648 915455 131072 1964031 131072 1898495 196608 849919 1245184 325631 720896 1374207 7208...

result:

ok 1

Test #39:

score: 0
Accepted
time: 77ms
memory: 24844kb

input:

1027

output:

Yes
0 2095103 2097152 1046527 1048576 522239 524288 1570815 524288 1308671 786432 260095 1310720 784383 262144 1832959 262144 1701887 393216 653311 1441792 129023 917504 1177599 655360 1439743 655360 391167 1179648 915455 131072 1964031 131072 1898495 196608 849919 1245184 325631 720896 1374207 7208...

result:

ok 1

Extra Test:

score: 0
Extra Test Passed