QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#670322#9485. (mod N² + 1)bulijiojiodibuliduo#AC ✓25ms10592kbC++174.9kb2024-10-23 21:19:032024-10-23 21:19:05

Judging History

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

  • [2024-10-23 21:19:05]
  • 评测
  • 测评结果:AC
  • 用时:25ms
  • 内存:10592kb
  • [2024-10-23 21:19:03]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
//typedef double db;
mt19937 mrand(random_device{}()); 
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

typedef pair<ll,ll> PLL;
namespace Factor {
	const int N=1010000;
	ll C,fac[10010],n,mut,a[1001000];
	int T,cnt,i,l,prime[N],p[N],psize,_cnt;
	ll _e[100],_pr[100];
	vector<ll> d;
	inline ll mul(ll a,ll b,ll p) {
		if (p<=1000000000) return a*b%p;
		else if (p<=1000000000000ll) return (((a*(b>>20)%p)<<20)+(a*(b&((1<<20)-1))))%p;
		else {
			ll d=(ll)floor(a*(long double)b/p+0.5);
			ll ret=(a*b-d*p)%p;
			if (ret<0) ret+=p;
			return ret;
		}
	}
	void prime_table(){
		int i,j,tot,t1;
		for (i=1;i<=psize;i++) p[i]=i;
		for (i=2,tot=0;i<=psize;i++){
			if (p[i]==i) prime[++tot]=i;
			for (j=1;j<=tot && (t1=prime[j]*i)<=psize;j++){
				p[t1]=prime[j];
				if (i%prime[j]==0) break;
			}
		}
	}
	void init(int ps) {
		psize=ps;
		prime_table();
	}
	ll powl(ll a,ll n,ll p) {
		ll ans=1;
		for (;n;n>>=1) {
			if (n&1) ans=mul(ans,a,p);
			a=mul(a,a,p);
		}
		return ans;
	}
	bool witness(ll a,ll n) {
		int t=0;
		ll u=n-1;
		for (;~u&1;u>>=1) t++;
		ll x=powl(a,u,n),_x=0;
		for (;t;t--) {
			_x=mul(x,x,n);
			if (_x==1 && x!=1 && x!=n-1) return 1;
			x=_x;
		}
		return _x!=1;
	}
	bool miller(ll n) {
		if (n<2) return 0;
		if (n<=psize) return p[n]==n;
		if (~n&1) return 0;
		for (int j=0;j<=7;j++) if (witness(rand()%(n-1)+1,n)) return 0;
		return 1;
	}
	ll gcd(ll a,ll b) {
		ll ret=1;
		while (a!=0) {
			if ((~a&1) && (~b&1)) ret<<=1,a>>=1,b>>=1;
			else if (~a&1) a>>=1; else if (~b&1) b>>=1;
			else {
				if (a<b) swap(a,b);
				a-=b;
			}
		}
		return ret*b;
	}
	ll rho(ll n) {
		for (;;) {
			ll X=rand()%n,Y,Z,T=1,*lY=a,*lX=lY;
			int tmp=20;
			C=rand()%10+3;
			X=mul(X,X,n)+C;*(lY++)=X;lX++;
			Y=mul(X,X,n)+C;*(lY++)=Y;
			for(;X!=Y;) {
				ll t=X-Y+n;
				Z=mul(T,t,n);
				if(Z==0) return gcd(T,n);
				tmp--;
				if (tmp==0) {
					tmp=20;
					Z=gcd(Z,n);
					if (Z!=1 && Z!=n) return Z;
				}
				T=Z;
				Y=*(lY++)=mul(Y,Y,n)+C;
				Y=*(lY++)=mul(Y,Y,n)+C;
				X=*(lX++);
			}
		}
	}
	void _factor(ll n) {
		for (int i=0;i<cnt;i++) {
			if (n%fac[i]==0) n/=fac[i],fac[cnt++]=fac[i];}
		if (n<=psize) {
			for (;n!=1;n/=p[n]) fac[cnt++]=p[n];
			return;
		}
		if (miller(n)) fac[cnt++]=n;
		else {
			ll x=rho(n);
			_factor(x);_factor(n/x);
		}
	}
	void dfs(ll x,int dep) {
		if (dep==_cnt) d.pb(x);
		else {
			dfs(x,dep+1);
			for (int i=1;i<=_e[dep];i++) dfs(x*=_pr[dep],dep+1);
		}
	}
	void norm() {
		sort(fac,fac+cnt);
		_cnt=0;
		rep(i,0,cnt) if (i==0||fac[i]!=fac[i-1]) _pr[_cnt]=fac[i],_e[_cnt++]=1;
			else _e[_cnt-1]++;
	}
	vector<ll> getd() {
		d.clear();
		dfs(1,0);
		return d;
	}
	vector<ll> factor(ll n) {
		cnt=0;
		_factor(n);
		norm();
		return getd();
	}
	vector<PLL> factorG(ll n) {
		cnt=0;
		_factor(n);
		norm();
		vector<PLL> d;
		rep(i,0,_cnt) d.pb(mp(_pr[i],_e[i]));
		return d;
	}
	bool is_primitive(ll a,ll p) {
		assert(miller(p));
		vector<PLL> D=factorG(p-1);
		a%=p;
		if (a<0) a+=p;
		if (a==0) return 0;
		rep(i,0,SZ(D)) if (powl(a,(p-1)/D[i].fi,p)==1) return 0;
		return 1;
	}
	ll get_primitive(ll p) {
		assert(miller(p));
		vector<PLL> D=factorG(p-1);
		for (int a=1;a<p;a++) {
			bool val=1;
			rep(i,0,SZ(D)) if (powl(a,(p-1)/D[i].fi,p)==1) {
				val=0;
				break;
			}
			if (val) return a;
		}
		return -1;
	}
}

ll a[111][111];
int n,r;
void build(int n) {
	for (int i=0;i<n;i++) for (int j=0;j<n;j++) {
		if (i==0) {
			a[0][j]=(j+1)/2*(j%2==0?-1:1);
		} else if (j==0) {
			a[i][0]=(i*n/2+(i%2))*(i%2==0?-1:1);
		} else {
			a[i][j]=2-a[i-1][j-1]-a[i-1][j]-a[i][j-1];
		}
	}	
}
void solve() {
	scanf("%d%d",&n,&r);
	if (!Factor::miller(n*n+1)) {
		if (n==3&&r==0) {
			puts("Yes\n1 2 3\n4 5 6\n 7 8 9");
			return;
		}
		puts("No");
		return;
		// not sure
	}
	int p=n*n+1;
	ll g=Factor::get_primitive(p);
	if (r==0) { puts("No"); return; }
	ll c=1,ord=-1;
	for (int z=0;z<p;z++) {
		if (c==r) {
			ord=z; break;
		}
		c=c*g%p;
	}
	if (ord%4!=2) { puts("No"); return; }
	build(n);
	puts("Yes");
	for (int i=0;i<n;i++) for (int j=0;j<n;j++) {
		a[i][j]+=(ord-2)/4;
		a[i][j]=powmod(g,a[i][j]+p-1,p);
		printf("%lld%c",a[i][j]," \n"[j==n-1]);
	}
}

int _;
int main() {
	Factor::init(100000);
	for (scanf("%d",&_);_;_--) {
		solve();
	}
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 8208kb

input:

3
2 4
3 3
4 2

output:

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

result:

ok Correct Answer

Test #2:

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

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
1 2 99 4 148 8 74 16 37 32 117 64 157 128
59 177 118 187 39 192 78 96 156 48 115 24 33 12
6 66 3 132 100 67 50 134 25 71 111 142 154 87
174 77 151 137 105 167 13 182 26 91 52 144 104 72
36 11 18 22 9 44 103 88 150 176 75 155 136 113
29 68 58 34 116 17 35 107 70 152 140 76 83 38
19 166 108 135 54...

result:

ok Correct Answer

Test #3:

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

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
185 41 233 123 249 112 83 79 199 237 152 197 222 77 74 231
179 196 23 151 69 136 207 131 107 215 64 243 192 81 62 27
9 186 3 44 1 132 86 139 200 160 238 223 165 155 55 208
110 104 73 206 219 240 143 80 172 198 2 66 6 22 18 93
31 54 96 162 32 229 182 173 232 5 163 15 140 45 218 135
148 244 187 16...

result:

ok Correct Answer

Test #4:

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

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
306 116 102 348 34 242 145 325 182 173 328 118 243 354 81 260 27 379 9 335
203 3 208 1 223 134 268 312 2 104 6 302 18 368 54 390 162 130 85 177
59 255 287 364 363 290 121 68 174 204 58 211 153 232 51 295 17 83 273 249
346 91 236 164 307 322 119 241 357 214 269 205 5 202 15 201 45 67 135 156
52 4...

result:

ok Correct Answer

Test #5:

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

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
270 196 54 403 357 284 533 266 222 176 506 303 332 361 528 74 221 370 275 119 55 18 11 90
450 233 519 162 287 494 281 445 251 89 101 364 505 419 217 430 508 86 232 248 6 165 30 33
122 150 486 173 328 288 181 286 267 276 515 226 103 553 136 457 258 554 167 462 495 2 99 10
50 366 250 304 96 407 48...

result:

ok Correct Answer

Test #6:

score: 0
Accepted
time: 10ms
memory: 10424kb

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
512 347 256 17 128 34 64 68 32 136 16 272 8 544 4 411 2 145 1 290 339 580 508 483 254 289
578 127 479 402 281 201 562 439 447 558 217 279 434 478 191 239 382 458 87 229 174 453 348 565 19 621
649 38 663 76 670 152 335 304 506 608 253 539 465 401 571 125 624 250 312 500 156 323 78 646 39 615
553 ...

result:

ok Correct Answer

Test #7:

score: 0
Accepted
time: 17ms
memory: 8368kb

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
608 539 304 401 152 125 76 250 38 500 19 323 348 646 174 615 87 553 382 429 191 181 434 362 217 47
94 447 188 562 376 281 75 479 150 578 300 289 600 483 523 580 369 290 61 145 122 411 244 544 488 272
136 299 68 598 34 519 17 361 347 45 512 90 256 180 128 360 64 43 32 86 16 172 8 344 4 11
22 2 44...

result:

ok Correct Answer

Test #8:

score: 0
Accepted
time: 19ms
memory: 8320kb

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
818 398 860 89 86 890 268 1118 805 804 729 258 462 1283 565 1157 705 1194 719 267 461 76 954 760 1133 1115 243 774 154 1255 1053 877 235 988 672 801
228 586 983 318 751 810 1025 81 1171 916 37 351 370 943 1106 224 684 1060 355 106 956 270 481 27 919 1170 111 117 1110 1179 724 507 755 1218 1065 9...

result:

ok Correct Answer

Test #9:

score: 0
Accepted
time: 19ms
memory: 8236kb

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
17 170 1169 403 506 139 310 93 31 930 911 221 999 913 489 51 438 510 822 1209 601 417 968 279 875 196 736 663 333 145 163 153 146 233 274 1033
1251 1065 837 755 588 724 692 1110 435 111 459 919 699 481 505 956 1159 355 1214 684 467 1106 779 370 8 37 80 1171 800 1025 218 751 883 983 1048 228
801 ...

result:

ok Correct Answer

Test #10:

score: 0
Accepted
time: 18ms
memory: 8308kb

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
839 608 473 892 177 1138 1185 1004 767 961 1244 531 1162 122 635 1220 712 527 590 82 59 820 395 418 688 289 847 296 1252 366 644 1066 1102 284 629 246
1163 452 1254 564 867 1094 888 1147 1098 1282 604 647 852 1232 738 642 895 583 1168 188 7 797 70 1247 700 1292 515 648 1259 843 917 214 91 1059 9...

result:

ok Correct Answer

Test #11:

score: 0
Accepted
time: 24ms
memory: 10592kb

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
301 903 634 1108 745 122 782 366 1328 1098 1510 92 1037 276 1413 828 471 883 157 1048 586 1543 729 1427 243 1079 81 35 27 105 9 315 3 945 1 1234 534 500 178 1500
1298 593 692 1265 475 1489 1425 1030 1073 877 17 826 51 809 153 1337 459 1513 1377 1038 929 346 1186 649 356 750 1068 250 2 617 6 1273...

result:

ok Correct Answer

Test #12:

score: 0
Accepted
time: 24ms
memory: 8244kb

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
1102 104 901 312 834 936 278 1207 1160 419 1454 1257 1552 569 1051 106 884 318 1362 954 454 1261 685 581 762 142 254 426 1152 1278 384 632 128 295 1110 885 370 1054 657 1561
1481 219 1241 73 521 558 1563 186 1487 62 1259 1088 575 1430 124 1544 372 1582 1116 1061 146 1421 438 1541 1314 1581 740 5...

result:

ok Correct Answer

Test #13:

score: 0
Accepted
time: 25ms
memory: 8548kb

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
727 580 776 139 1326 417 442 1251 681 551 227 52 1143 156 381 468 127 1404 576 1010 192 1429 64 1085 555 53 185 159 1129 477 910 1431 837 1091 279 71 93 213 31 639
316 544 948 715 1243 772 527 791 1581 1331 1541 1511 1421 1571 1061 1591 1582 1064 1544 1422 1430 474 1088 158 62 1120 186 907 558 8...

result:

ok Correct Answer

Test #14:

score: 0
Accepted
time: 10ms
memory: 10348kb

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
657 370 219 1110 73 128 558 384 186 1152 62 254 1088 762 1430 685 1544 454 1582 1362 1061 884 1421 1051 1541 1552 1581 1454 527 1160 1243 278 948 834 316 901 639 1102 213 104
312 71 936 1091 1207 1431 419 477 1257 159 569 53 106 1085 318 1429 954 1010 1261 1404 581 468 142 156 426 52 1278 551 63...

result:

ok Correct Answer

Test #15:

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

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

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

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

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

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

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: 2ms
memory: 9816kb

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

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: 2ms
memory: 9936kb

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

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

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
1 2
4 3
Yes
1 2 3
4 5 6
 7 8 9
No
No
No
No
No
No
No
No
No
No
No
Yes
10 13 9 5
15 3 11 1
6 16 2 14
8 12 7 4
No
No
No
No
No
Yes
9 10 3 13
5 1 15 6
2 11 12 16
14 4 8 7
Yes
1 3 6 9
10 2 13 12
4 5 7 15
11 8 16 14
No
No
No
No
No
Yes
3 9 1 10
13 6 5 2
12 15 4 11
16 7 14 8
No
No
No
No
No
No
...

result:

ok Correct Answer

Test #26:

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

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

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
1 2 51 4...

result:

ok Correct Answer

Test #28:

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

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

result:

ok Correct Answer

Extra Test:

score: 0
Extra Test Passed