QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#731132#9485. (mod N² + 1)TheZoneAC ✓9ms3740kbC++235.8kb2024-11-10 00:03:082024-11-10 00:03:08

Judging History

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

  • [2024-11-10 00:03:08]
  • 评测
  • 测评结果:AC
  • 用时:9ms
  • 内存:3740kb
  • [2024-11-10 00:03:08]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define fr(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);
using namespace std;
const int N=55;
int T,n,r,p,lg[N*N],pw[N*N],a[N][N];
namespace GG
{
	int n;vector<int>g;
	inline int ksm(int x,int p){int s=1;for(;p;(p&1)&&(s=1ll*s*x%n),x=1ll*x*x%n,p>>=1);return s;}
	inline bool isy(int x){if(__gcd(x,n)>1) return 0;for(int i:g) if(ksm(x,i)==1) return 0;return 1;}
	inline int gg(int x)
	{
		g.clear();int t=(n=x)-1,y=t;
		for(int i=2;i*i<=y;i++) if(y%i==0){while(y%i==0) y/=i;g.push_back(t/i);}(y^1)&&(g.push_back(t/y),1);
		for(int i=1;i<x;i++) if(isy(i)) return i;
	}
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>T;
	while(T--)
	{
		cin>>n>>r;
		if(n==1){cout<<"Yes\n1\n";continue;}
		if(n==3&&!r){cout<<"Yes\n1 2 3\n4 5 6\n7 8 9\n";continue;}
		p=n*n+1;bool o=1;
		for(int i=2;i*i<=p;i++) if(!(p%i)){o=0;break;}
		if(!o||!r){cout<<"No\n";continue;}int g=GG::gg(p);
		for(int i=0,s=1;i<p-1;i++,s=1ll*s*g%p) lg[pw[i]=s]=i;
		r=lg[r];int cnt=0;
		if((r&3)!=2){cout<<"No\n";continue;}
		for(int i=1;i<=n;i+=2) for(int j=1;j<=n;j+=2) a[i][j]=++cnt;
		for(int i=n-1;i>0;i-=2) for(int j=2;j<=n;j+=2) a[i][j]=++cnt;
		for(int i=2;i<=n;i+=2) for(int j=n-1;j>0;j-=2) a[i][j]=++cnt;
		for(int i=n;i>0;i-=2) for(int j=n;j>0;j-=2) a[i][j]=++cnt;
		int d=(r-2)/4;cout<<"Yes\n";
		for(int i=1;i<=n;i++,cout<<"\n") for(int j=1;j<=n;j++)
			cout<<pw[(a[i][j]+d)%(p-1)]<<" ";
	}
	return 0;
}
/*#include<bits/stdc++.h>
#define LL long long
#define fr(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);
using namespace std;
const int N=55;
int T,n,r,p,lg[N*N],pw[N*N],a[N][N];
namespace GG
{
	int n;vector<int>g;
	inline int ksm(int x,int p){int s=1;for(;p;(p&1)&&(s=1ll*s*x%n),x=1ll*x*x%n,p>>=1);return s;}
	inline bool isy(int x){if(__gcd(x,n)>1) return 0;for(int i:g) if(ksm(x,i)==1) return 0;return 1;}
	inline int gg(int x)
	{
		g.clear();int t=(n=x)-1,y=t;
		for(int i=2;i*i<=y;i++) if(y%i==0){while(y%i==0) y/=i;g.push_back(t/i);}(y^1)&&(g.push_back(t/y),1);
		for(int i=1;i<x;i++) if(isy(i)) return i;
	}
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>T;
	while(T--)
	{
		cin>>n>>r;
		if(n==1){cout<<"Yes\n1\n";continue;}
		if(n==3&&!r){cout<<"Yes\n1 2 3\n4 5 6\n7 8 9\n";continue;}
		p=n*n+1;bool o=1;
		for(int i=2;i*i<=p;i++) if(!(p%i)){o=0;break;}
		if(!o||!r){cout<<"No\n";continue;}int g=GG::gg(p);
		for(int i=0,s=1;i<p-1;i++,s=1ll*s*g%p) lg[pw[i]=s]=i;
		r=lg[r];int cnt=0;
		if((r&3)!=2){cout<<"No\n";continue;}
		for(int i=1;i<=n;i+=2) for(int j=1;j<=n;j+=2) a[i][j]=++cnt;
		for(int i=n-1;i>0;i-=2) for(int j=2;j<=n;j+=2) a[i][j]=++cnt;
		for(int i=2;i<=n;i+=2) for(int j=n-1;j>0;j-=2) a[i][j]=++cnt;
		for(int i=n;i>0;i-=2) for(int j=n;j>0;j-=2) a[i][j]=++cnt;
		int d=(r-2)/4;cout<<"Yes\n";
		for(int i=1;i<=n;i++,cout<<"\n") for(int j=1;j<=n;j++)
			cout<<pw[(a[i][j]+d)%(p-1)]<<" ";
	}
	return 0;
}#include<bits/stdc++.h>
#define LL long long
#define fr(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);
using namespace std;
const int N=55;
int T,n,r,p,lg[N*N],pw[N*N],a[N][N];
namespace GG
{
	int n;vector<int>g;
	inline int ksm(int x,int p){int s=1;for(;p;(p&1)&&(s=1ll*s*x%n),x=1ll*x*x%n,p>>=1);return s;}
	inline bool isy(int x){if(__gcd(x,n)>1) return 0;for(int i:g) if(ksm(x,i)==1) return 0;return 1;}
	inline int gg(int x)
	{
		g.clear();int t=(n=x)-1,y=t;
		for(int i=2;i*i<=y;i++) if(y%i==0){while(y%i==0) y/=i;g.push_back(t/i);}(y^1)&&(g.push_back(t/y),1);
		for(int i=1;i<x;i++) if(isy(i)) return i;
	}
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>T;
	while(T--)
	{
		cin>>n>>r;
		if(n==1){cout<<"Yes\n1\n";continue;}
		if(n==3&&!r){cout<<"Yes\n1 2 3\n4 5 6\n7 8 9\n";continue;}
		p=n*n+1;bool o=1;
		for(int i=2;i*i<=p;i++) if(!(p%i)){o=0;break;}
		if(!o||!r){cout<<"No\n";continue;}int g=GG::gg(p);
		for(int i=0,s=1;i<p-1;i++,s=1ll*s*g%p) lg[pw[i]=s]=i;
		r=lg[r];int cnt=0;
		if((r&3)!=2){cout<<"No\n";continue;}
		for(int i=1;i<=n;i+=2) for(int j=1;j<=n;j+=2) a[i][j]=++cnt;
		for(int i=n-1;i>0;i-=2) for(int j=2;j<=n;j+=2) a[i][j]=++cnt;
		for(int i=2;i<=n;i+=2) for(int j=n-1;j>0;j-=2) a[i][j]=++cnt;
		for(int i=n;i>0;i-=2) for(int j=n;j>0;j-=2) a[i][j]=++cnt;
		int d=(r-2)/4;cout<<"Yes\n";
		for(int i=1;i<=n;i++,cout<<"\n") for(int j=1;j<=n;j++)
			cout<<pw[(a[i][j]+d)%(p-1)]<<" ";
	}
	return 0;
}#include<bits/stdc++.h>
#define LL long long
#define fr(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);
using namespace std;
const int N=55;
int T,n,r,p,lg[N*N],pw[N*N],a[N][N];
namespace GG
{
	int n;vector<int>g;
	inline int ksm(int x,int p){int s=1;for(;p;(p&1)&&(s=1ll*s*x%n),x=1ll*x*x%n,p>>=1);return s;}
	inline bool isy(int x){if(__gcd(x,n)>1) return 0;for(int i:g) if(ksm(x,i)==1) return 0;return 1;}
	inline int gg(int x)
	{
		g.clear();int t=(n=x)-1,y=t;
		for(int i=2;i*i<=y;i++) if(y%i==0){while(y%i==0) y/=i;g.push_back(t/i);}(y^1)&&(g.push_back(t/y),1);
		for(int i=1;i<x;i++) if(isy(i)) return i;
	}
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>T;
	while(T--)
	{
		cin>>n>>r;
		if(n==1){cout<<"Yes\n1\n";continue;}
		if(n==3&&!r){cout<<"Yes\n1 2 3\n4 5 6\n7 8 9\n";continue;}
		p=n*n+1;bool o=1;
		for(int i=2;i*i<=p;i++) if(!(p%i)){o=0;break;}
		if(!o||!r){cout<<"No\n";continue;}int g=GG::gg(p);
		for(int i=0,s=1;i<p-1;i++,s=1ll*s*g%p) lg[pw[i]=s]=i;
		r=lg[r];int cnt=0;
		if((r&3)!=2){cout<<"No\n";continue;}
		for(int i=1;i<=n;i+=2) for(int j=1;j<=n;j+=2) a[i][j]=++cnt;
		for(int i=n-1;i>0;i-=2) for(int j=2;j<=n;j+=2) a[i][j]=++cnt;
		for(int i=2;i<=n;i+=2) for(int j=n-1;j>0;j-=2) a[i][j]=++cnt;
		for(int i=n;i>0;i-=2) for(int j=n;j>0;j-=2) a[i][j]=++cnt;
		int d=(r-2)/4;cout<<"Yes\n";
		for(int i=1;i<=n;i++,cout<<"\n") for(int j=1;j<=n;j++)
			cout<<pw[(a[i][j]+d)%(p-1)]<<" ";
	}
	return 0;
}*/

詳細信息

Test #1:

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

input:

3
2 4
3 3
4 2

output:

Yes
2 4 
3 1 
No
Yes
13 8 5 7 
12 10 4 9 
15 16 11 14 
6 3 2 1 

result:

ok Correct Answer

Test #2:

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

input:

100
14 4
14 6
14 7
14 9
14 10
14 15
14 19
14 22
14 25
14 26
14 33
14 39
14 41
14 43
14 47
14 55
14 62
14 64
14 65
14 83
14 92
14 93
14 96
14 97
14 107
14 109
14 112
14 116
14 121
14 127
14 134
14 136
14 137
14 138
14 143
14 144
14 146
14 148
14 155
14 157
14 160
14 161
14 163
14 168
14 169
14 173
14...

output:

Yes
2 40 4 80 8 160 16 123 32 49 64 98 128 196 
69 1 133 99 165 148 181 74 189 37 193 117 195 157 
59 185 118 173 39 149 78 101 156 5 115 10 33 20 
164 177 82 187 41 192 119 96 158 48 79 24 138 12 
66 43 132 86 67 172 134 147 71 97 142 194 87 191 
110 6 55 3 126 100 63 50 130 25 65 111 131 154 
174 ...

result:

ok Correct Answer

Test #3:

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

input:

100
16 205
16 207
16 208
16 215
16 221
16 226
16 228
16 231
16 232
16 236
16 239
16 244
16 248
20 2
20 7
20 8
20 9
20 10
20 11
20 28
20 32
20 35
20 36
20 40
20 43
20 44
20 45
20 47
20 50
20 55
20 58
20 73
20 78
20 82
20 89
20 98
20 102
20 103
20 109
20 111
20 112
20 114
20 126
20 128
20 138
20 140
2...

output:

Yes
41 183 123 35 112 105 79 58 237 174 197 8 77 24 231 72 
26 185 180 233 60 249 20 83 178 199 145 152 134 222 216 74 
179 230 23 176 69 14 207 42 107 126 64 121 192 106 62 61 
195 196 65 151 193 136 150 131 50 215 188 243 234 81 78 27 
186 202 44 92 132 19 139 57 160 171 223 256 155 254 208 248 
4...

result:

ok Correct Answer

Test #4:

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

input:

100
20 357
20 358
20 361
20 365
20 366
20 369
20 373
20 390
20 391
20 392
20 393
20 394
20 399
24 11
24 17
24 22
24 23
24 25
24 33
24 34
24 35
24 44
24 46
24 49
24 50
24 51
24 53
24 59
24 66
24 68
24 69
24 70
24 75
24 88
24 92
24 98
24 99
24 100
24 102
24 105
24 106
24 118
24 127
24 131
24 132
24 13...

output:

Yes
116 392 348 374 242 320 325 158 173 73 118 219 354 256 260 367 379 299 335 95 
66 306 22 102 141 34 47 145 283 182 228 328 76 243 159 81 53 27 285 9 
203 224 208 271 223 11 268 33 2 99 6 297 18 89 54 267 162 400 85 398 
316 3 239 1 347 134 383 312 395 104 399 302 133 368 178 390 193 130 198 177 ...

result:

ok Correct Answer

Test #5:

score: 0
Accepted
time: 4ms
memory: 3592kb

input:

100
24 354
24 362
24 365
24 367
24 368
24 370
24 373
24 377
24 379
24 381
24 392
24 393
24 396
24 400
24 401
24 408
24 414
24 418
24 420
24 424
24 427
24 430
24 437
24 439
24 441
24 445
24 446
24 450
24 459
24 471
24 472
24 475
24 477
24 478
24 479
24 485
24 489
24 502
24 507
24 508
24 509
24 511
24...

output:

Yes
196 566 403 522 284 302 266 356 176 49 303 245 361 71 74 355 370 44 119 220 18 523 90 307 
487 270 559 54 458 357 207 533 503 222 216 506 274 332 401 528 311 221 293 275 174 55 381 11 
450 544 519 412 287 329 281 491 251 147 101 158 505 213 217 488 508 132 232 83 6 415 30 344 
547 233 571 162 34...

result:

ok Correct Answer

Test #6:

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

input:

100
26 152
26 155
26 157
26 160
26 161
26 163
26 164
26 167
26 173
26 178
26 183
26 184
26 187
26 191
26 193
26 198
26 201
26 209
26 218
26 219
26 220
26 222
26 223
26 235
26 236
26 249
26 251
26 253
26 262
26 265
26 273
26 283
26 284
26 289
26 294
26 301
26 306
26 307
26 312
26 315
26 323
26 324
26...

output:

Yes
347 423 17 169 34 338 68 676 136 675 272 673 544 669 411 661 145 645 290 613 580 549 483 421 289 165 
388 512 194 256 97 128 387 64 532 32 266 16 133 8 405 4 541 2 609 1 643 339 660 508 330 254 
578 56 479 112 281 224 562 448 447 219 217 438 434 199 191 398 382 119 87 238 174 476 348 275 19 550 ...

result:

ok Correct Answer

Test #7:

score: 0
Accepted
time: 6ms
memory: 3680kb

input:

100
26 582
26 584
26 587
26 590
26 591
26 592
26 593
26 596
26 599
26 606
26 618
26 622
26 631
26 636
26 637
26 639
26 641
26 642
26 643
26 655
26 661
26 662
26 663
26 664
26 671
26 676
36 2
36 6
36 7
36 8
36 13
36 18
36 21
36 24
36 25
36 28
36 32
36 38
36 39
36 46
36 47
36 52
36 54
36 55
36 61
36 6...

output:

Yes
539 460 401 243 125 486 250 295 500 590 323 503 646 329 615 658 553 639 429 601 181 525 362 373 47 69 
630 608 315 304 496 152 248 76 124 38 62 19 31 348 354 174 177 87 427 382 552 191 276 434 138 217 
94 405 188 133 376 266 75 532 150 387 300 97 600 194 523 388 369 99 61 198 122 396 244 115 488...

result:

ok Correct Answer

Test #8:

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

input:

100
36 289
36 291
36 294
36 295
36 299
36 300
36 303
36 309
36 318
36 319
36 321
36 326
36 334
36 336
36 338
36 340
36 341
36 342
36 343
36 350
36 351
36 359
36 363
36 370
36 371
36 384
36 386
36 388
36 392
36 395
36 397
36 398
36 399
36 400
36 404
36 410
36 412
36 414
36 415
36 417
36 423
36 424
36...

output:

Yes
398 625 89 1062 890 244 1118 1143 804 1054 258 164 1283 343 1157 836 1194 578 267 592 76 732 760 835 1115 568 774 492 1255 1029 877 1211 988 437 801 479 
496 818 309 860 420 86 42 268 523 805 182 729 537 462 1221 565 1030 705 103 719 140 461 14 954 1039 1133 493 243 179 154 407 1053 1208 235 899...

result:

ok Correct Answer

Test #9:

score: 0
Accepted
time: 7ms
memory: 3620kb

input:

100
36 717
36 722
36 728
36 730
36 732
36 733
36 734
36 736
36 741
36 745
36 748
36 751
36 752
36 756
36 765
36 770
36 785
36 802
36 804
36 811
36 813
36 814
36 822
36 829
36 831
36 832
36 841
36 849
36 852
36 854
36 862
36 864
36 867
36 869
36 873
36 874
36 880
36 882
36 883
36 885
36 887
36 893
36...

output:

Yes
170 1023 403 1151 139 1134 93 964 930 561 221 422 913 329 51 696 510 475 1209 859 417 808 279 298 196 386 663 1266 145 987 153 791 233 128 1033 1280 
264 17 1064 1169 1144 506 1152 310 634 31 1101 911 1018 999 880 489 88 438 787 822 1246 601 384 968 1076 875 367 736 1204 333 1158 163 894 146 112...

result:

ok Correct Answer

Test #10:

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

input:

100
36 1132
36 1135
36 1136
36 1141
36 1142
36 1145
36 1152
36 1156
36 1158
36 1159
36 1164
36 1169
36 1176
36 1180
36 1183
36 1185
36 1190
36 1191
36 1194
36 1196
36 1197
36 1199
36 1200
36 1201
36 1212
36 1213
36 1222
36 1225
36 1226
36 1230
36 1234
36 1236
36 1242
36 1243
36 1245
36 1250
36 1251
...

output:

Yes
608 668 892 195 1138 653 1004 45 961 450 531 609 122 902 1220 1238 527 707 82 585 820 662 418 135 289 53 296 530 366 112 1066 1120 284 824 246 458 
1051 839 1013 473 231 177 931 1185 1001 767 1008 1244 879 1162 477 635 1215 712 770 590 77 59 1175 395 766 688 336 847 293 1252 159 644 405 1102 689...

result:

ok Correct Answer

Test #11:

score: 0
Accepted
time: 4ms
memory: 3684kb

input:

100
40 205
40 206
40 213
40 215
40 218
40 225
40 227
40 233
40 235
40 238
40 242
40 245
40 249
40 261
40 263
40 264
40 268
40 279
40 281
40 286
40 288
40 289
40 296
40 303
40 307
40 312
40 313
40 322
40 328
40 330
40 335
40 338
40 339
40 342
40 344
40 347
40 349
40 353
40 354
40 356
40 358
40 359
40...

output:

Yes
903 1423 1108 1067 122 1600 366 1598 1098 1592 92 1574 276 1520 828 1358 883 872 1048 1015 1543 1444 1427 1130 1079 188 35 564 105 91 315 273 945 819 1234 856 500 967 1500 1300 
101 301 1101 634 367 745 656 782 1286 1328 1496 1510 1566 1037 522 1413 174 471 58 157 553 586 718 729 773 243 1325 81...

result:

ok Correct Answer

Test #12:

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

input:

100
40 621
40 624
40 626
40 627
40 631
40 633
40 644
40 647
40 649
40 656
40 660
40 661
40 669
40 670
40 676
40 678
40 683
40 684
40 687
40 688
40 693
40 694
40 698
40 701
40 703
40 706
40 708
40 711
40 712
40 715
40 716
40 718
40 720
40 729
40 740
40 741
40 746
40 749
40 752
40 756
40 767
40 776
40...

output:

Yes
104 944 312 1231 936 491 1207 1473 419 1217 1257 449 569 1347 106 839 318 916 954 1147 1261 239 581 717 142 550 426 49 1278 147 632 441 295 1323 885 767 1054 700 1561 499 
40 1102 547 901 716 834 1306 278 969 1160 323 1454 1175 1552 1459 1051 1020 884 340 1362 647 454 1283 685 1495 762 1032 254 ...

result:

ok Correct Answer

Test #13:

score: 0
Accepted
time: 9ms
memory: 3656kb

input:

100
40 987
40 995
40 996
40 1006
40 1009
40 1022
40 1023
40 1025
40 1029
40 1030
40 1039
40 1043
40 1044
40 1052
40 1056
40 1058
40 1065
40 1072
40 1073
40 1075
40 1079
40 1086
40 1090
40 1098
40 1103
40 1111
40 1114
40 1116
40 1117
40 1124
40 1125
40 1131
40 1135
40 1142
40 1144
40 1147
40 1151
40 ...

output:

Yes
580 1570 139 1508 417 1322 1251 764 551 691 52 472 156 1416 468 1046 1404 1537 1010 1409 1429 1025 1085 1474 53 1220 159 458 477 1374 1431 920 1091 1159 71 275 213 825 639 874 
962 727 1388 776 1530 1326 510 442 170 681 1124 227 1442 1143 1548 381 516 127 172 576 591 192 197 64 1133 555 1445 185...

result:

ok Correct Answer

Test #14:

score: 0
Accepted
time: 5ms
memory: 3688kb

input:

50
40 1402
40 1405
40 1406
40 1407
40 1412
40 1413
40 1416
40 1421
40 1422
40 1423
40 1424
40 1429
40 1430
40 1432
40 1436
40 1437
40 1440
40 1445
40 1453
40 1457
40 1458
40 1467
40 1469
40 1480
40 1482
40 1492
40 1498
40 1503
40 1504
40 1507
40 1511
40 1512
40 1515
40 1519
40 1523
40 1527
40 1529
4...

output:

Yes
370 1388 1110 962 128 1285 384 653 1152 358 254 1074 762 20 685 60 454 180 1362 540 884 19 1051 57 1552 171 1454 513 1160 1539 278 1415 834 1043 901 1528 1102 1382 104 944 
1497 657 499 219 700 73 767 558 1323 186 441 62 147 1088 49 1430 550 1544 717 1582 239 1061 1147 1421 916 1541 839 1581 134...

result:

ok Correct Answer

Test #15:

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

input:

100
34 125
49 1179
48 1952
25 454
34 988
42 1332
46 283
22 384
39 1024
49 1642
23 175
30 493
34 630
40 23
47 698
49 1993
30 187
38 1114
46 464
35 1168
29 751
46 876
49 2314
44 135
35 178
44 85
43 844
31 340
32 270
33 328
23 286
32 404
45 1899
31 823
36 668
25 304
37 1015
37 286
46 795
49 208
26 210
...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #16:

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

input:

100
29 518
21 5
48 1239
35 317
46 938
37 538
50 1355
31 160
50 453
44 1131
29 483
47 1150
39 625
47 2183
44 867
37 615
31 385
42 1140
43 203
37 10
19 323
49 2235
32 825
48 740
17 125
49 287
36 776
35 124
37 635
45 597
19 310
32 971
39 78
31 33
50 1384
50 516
36 1017
49 1406
15 8
18 74
19 264
30 171
...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #17:

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

input:

100
28 111
50 1695
46 1525
48 850
32 420
45 1009
39 551
41 1629
28 598
42 230
47 416
28 180
31 954
19 7
45 1480
19 26
28 561
42 889
30 196
50 831
44 155
41 1246
49 916
47 1579
37 846
16 156
44 1154
39 1389
49 1020
45 669
48 354
38 1207
43 166
50 1937
34 54
38 1067
39 518
47 112
24 290
46 1107
40 73
...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #18:

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

input:

100
37 1332
50 1537
30 66
47 1228
49 1035
25 77
44 1193
20 37
42 171
21 50
42 375
50 2175
50 1926
41 640
49 788
31 16
45 1662
35 207
16 189
15 57
21 420
49 2095
32 1003
39 253
32 326
16 241
40 935
41 479
47 1419
42 1578
31 316
45 761
36 535
43 1251
49 175
46 1537
25 384
28 161
47 1820
11 38
40 128
3...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #19:

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

input:

100
47 1092
45 1000
46 1426
46 805
41 465
45 1964
36 562
39 1271
43 1079
39 671
36 212
48 534
49 1307
34 616
22 266
31 323
33 822
45 1025
38 681
31 637
49 169
50 2321
35 683
17 151
34 458
49 270
30 774
48 77
36 760
25 279
49 738
17 236
45 374
17 32
44 573
46 1195
39 194
37 997
47 1093
48 780
35 886
...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #20:

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

input:

100
47 2144
37 1205
41 680
39 228
48 2238
26 412
50 1573
39 215
49 576
34 750
24 452
47 1152
36 1253
50 1699
48 2004
48 1544
37 556
21 348
49 1528
49 2210
44 129
41 558
25 100
46 1151
23 1
43 1815
34 1084
31 869
13 1
47 1238
41 1413
41 815
46 1255
18 44
24 474
43 1363
50 544
39 51
45 1608
40 252
34 ...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #21:

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

input:

100
40 809
46 1371
39 602
27 655
50 810
33 907
40 181
46 58
33 87
37 1312
49 1266
37 1213
50 861
30 782
47 1611
43 1033
37 641
48 1797
39 345
35 158
27 179
46 1699
45 628
50 2326
31 91
49 1600
28 422
30 222
27 583
44 271
39 889
41 105
44 67
38 387
49 1011
45 1249
42 1621
41 416
20 18
45 1891
18 263
...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #22:

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

input:

100
32 716
43 483
17 23
32 587
19 184
33 913
44 1369
49 404
48 1878
40 1035
45 1968
29 457
46 2078
49 1404
19 41
44 224
40 1046
45 90
33 300
38 1125
49 1652
29 427
45 468
49 744
48 1720
16 235
44 877
44 538
24 559
20 260
45 159
49 1729
20 62
35 1023
15 203
38 1273
50 2479
35 244
29 550
31 687
45 197...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #23:

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

input:

100
38 470
46 1899
13 123
41 1132
38 1414
34 1021
33 212
40 1078
48 343
30 476
47 796
30 490
35 150
44 1247
19 177
38 205
33 628
40 544
21 87
44 814
49 1216
44 1767
20 13
34 887
42 1372
17 101
50 1277
13 148
44 960
21 261
48 1293
50 1881
45 1710
47 382
20 179
40 1314
30 369
37 1329
39 541
29 535
42 ...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #24:

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

input:

100
48 1753
31 279
48 1177
50 1524
41 1180
42 218
41 1170
50 1176
49 1071
12 117
27 369
47 832
28 274
29 766
38 1117
49 775
49 1134
31 163
50 1593
47 529
36 1097
35 176
30 19
45 447
48 1888
15 184
41 716
13 25
43 1695
40 76
46 1008
47 1467
28 609
44 380
36 324
38 186
48 2084
46 1718
48 2096
41 261
4...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #25:

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

input:

100
2 0
2 1
2 2
2 3
2 4
3 0
3 1
3 2
3 3
3 4
3 5
3 6
3 7
3 8
3 9
4 0
4 1
4 2
4 3
4 4
4 5
4 6
4 7
4 8
4 9
4 10
4 11
4 12
4 13
4 14
4 15
4 16
5 0
5 1
5 2
5 3
5 4
5 5
5 6
5 7
5 8
5 9
5 10
5 11
5 12
5 13
5 14
5 15
5 16
5 17
5 18
5 19
5 20
5 21
5 22
5 23
5 24
5 25
6 0
6 1
6 2
6 3
6 4
6 5
6 6
6 7
6 8
6 9
6...

output:

No
No
No
No
Yes
2 4 
3 1 
Yes
1 2 3
4 5 6
7 8 9
No
No
No
No
No
No
No
No
No
No
No
Yes
13 8 5 7 
12 10 4 9 
15 16 11 14 
6 3 2 1 
No
No
No
No
No
Yes
10 14 13 8 
4 9 7 3 
5 11 15 16 
2 1 12 6 
Yes
3 11 9 16 
8 1 14 6 
10 5 13 15 
4 2 7 12 
No
No
No
No
No
Yes
9 16 10 14 
7 3 8 1 
13 15 5 11 
12 6 4 2 
N...

result:

ok Correct Answer

Test #26:

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

input:

100
7 5
7 6
7 7
7 8
7 9
7 10
7 11
7 12
7 13
7 14
7 15
7 16
7 17
7 18
7 19
7 20
7 21
7 22
7 23
7 24
7 25
7 26
7 27
7 28
7 29
7 30
7 31
7 32
7 33
7 34
7 35
7 36
7 37
7 38
7 39
7 40
7 41
7 42
7 43
7 44
7 45
7 46
7 47
7 48
7 49
8 0
8 1
8 2
8 3
8 4
8 5
8 6
8 7
8 8
8 9
8 10
8 11
8 12
8 13
8 14
8 15
8 16
8...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok Correct Answer

Test #27:

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

input:

100
8 55
8 56
8 57
8 58
8 59
8 60
8 61
8 62
8 63
8 64
9 0
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
9 9
9 10
9 11
9 12
9 13
9 14
9 15
9 16
9 17
9 18
9 19
9 20
9 21
9 22
9 23
9 24
9 25
9 26
9 27
9 28
9 29
9 30
9 31
9 32
9 33
9 34
9 35
9 36
9 37
9 38
9 39
9 40
9 41
9 42
9 43
9 44
9 45
9 46
9 47
9 48
9 49
9 50
9...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
2 82 4 6...

result:

ok Correct Answer

Test #28:

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

input:

93
10 8
10 9
10 10
10 11
10 12
10 13
10 14
10 15
10 16
10 17
10 18
10 19
10 20
10 21
10 22
10 23
10 24
10 25
10 26
10 27
10 28
10 29
10 30
10 31
10 32
10 33
10 34
10 35
10 36
10 37
10 38
10 39
10 40
10 41
10 42
10 43
10 44
10 45
10 46
10 47
10 48
10 49
10 50
10 51
10 52
10 53
10 54
10 55
10 56
10 57...

output:

No
Yes
14 69 28 37 56 74 11 47 22 94 
79 7 90 54 45 27 73 64 87 32 
44 100 88 99 75 97 49 93 98 85 
3 16 52 8 26 4 13 2 57 1 
95 41 89 82 77 63 53 25 5 50 
96 51 48 76 24 38 12 19 6 60 
10 36 20 72 40 43 80 86 59 71 
42 30 21 15 61 58 81 29 91 65 
17 39 34 78 68 55 35 9 70 18 
31 83 66 92 33 46 67 2...

result:

ok Correct Answer

Extra Test:

score: 0
Extra Test Passed