QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#121528#6123. JAG Graph IsomorphismEastKingAC ✓113ms30204kbC++173.1kb2023-07-08 13:28:372023-07-08 13:28:39

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-08 13:28:39]
  • 评测
  • 测评结果:AC
  • 用时:113ms
  • 内存:30204kb
  • [2023-07-08 13:28:37]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
const int M=2e5+5;
const ull seed=1e8+7,pri=10001107;
ull base[M],pw[M];
int n;
struct Edge{
	int a,b;
};
int head[M],asdf;
struct edge{
	int to,nxt,id;
}G[M<<1];
void add_edge(int a,int b,int c){
	G[++asdf].to=b;
	G[asdf].id=c;
	G[asdf].nxt=head[a];
	head[a]=asdf;
}
bool mark[M];
int par[M];
int get_fa(int x){
	if(par[x]==x)return x;
	return par[x]=get_fa(par[x]);
}
int fa[M],ID[M],dep[M];
void dfs1(int x,int f){
	fa[x]=f;
	dep[x]=dep[f]+1;
	for(int i=head[x];i;i=G[i].nxt){
		int y=G[i].to;
		if(y==f)continue;
		ID[y]=G[i].id;
		dfs1(y,x);
	}
}
vector<int>get_cir(int x,int y){
	vector<int>lx;
	vector<int>ly;
	while(x!=y){
		if(dep[x]>=dep[y]){
			lx.push_back(x);
			mark[ID[x]]=1;
			x=fa[x];
		}else {
			ly.push_back(y);
			mark[ID[y]]=1;
			y=fa[y];
		}
	}
	lx.push_back(x);
	for(int i=(int)ly.size()-1;i>=0;i--){
		lx.push_back(ly[i]);
	}
	return lx;
}
int sz[M];
ull hs[M];
void dfs(int x,int f){
	sz[x]=1;
	hs[x]=0;
	vector<ull>son;
	for(int i=head[x];i;i=G[i].nxt){
		int y=G[i].to;
		if(y==f)continue;
		if(mark[G[i].id])continue;
		dfs(y,x);
		sz[x]+=sz[y];
		son.push_back(hs[y]);
	}
	if(son.size()>0){
		sort(son.begin(),son.end());
		for(int i=0;i<son.size();i++){
			hs[x]+=son[i]*base[i];
		}
		hs[x]*=sz[x];
	}else {
		hs[x]=1;
	}
}

vector<ull>solve(vector<Edge>&E){
	//clear
	asdf=0;
	for(int i=1;i<=n;i++)head[i]=0;
	int len=E.size();
	for(int i=0;i<len;i++)mark[i]=0;
	for(int i=1;i<=n;i++)par[i]=i;
	
	int eid=-1;
	for(int i=0;i<len;i++){
		int a=E[i].a;
		int b=E[i].b;
		int x=get_fa(a);
		int y=get_fa(b);
		if(x==y){
			eid=i;
			continue;
		}
		par[x]=y;
		add_edge(a,b,i);
		add_edge(b,a,i);
	}
	dfs1(1,0);
	vector<int>pot=get_cir(E[eid].a,E[eid].b);
	vector<ull>Ans;
	for(int i=0;i<pot.size();i++){
		dfs(pot[i],0);
		Ans.push_back(hs[pot[i]]);
	}
	return Ans;
}
//typedef unsigned long long ull;
ull qz[M];
bool check(vector<ull>&A,vector<ull>&B){
	if(A.size()!=B.size())return 0;
	int n=A.size();
	ull goal=0;
	for(int i=0;i<n;i++){
		goal=goal*pri+A[i];
	}
	for(int i=0;i<n;i++){
		if(i>0)qz[i]=qz[i-1]*pri;
		else qz[i]=0;
		qz[i]+=B[i];
	}
	for(int i=n;i<2*n;i++){
		qz[i]=qz[i-1]*pri+B[i-n];
		if(qz[i]-qz[i-n]*pw[n]==goal)return 1;
	}
	return 0;
}
int main(){
	//init
	base[0]=1;
	pw[0]=1;
	for(int i=1;i<M;i++){
		base[i]=base[i-1]*seed;
		pw[i]=pw[i-1]*pri;
	}

	scanf("%d",&n);
	vector<Edge>G1;
	for(int i=1;i<=n;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		G1.push_back({a,b});
	}
	vector<Edge>G2;
	for(int i=1;i<=n;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		G2.push_back({a,b});
	}
	vector<ull>A=solve(G1);
	vector<ull>B=solve(G2);
//	for(auto x:A)printf("%llu ",x);
//	printf("\n");
//	for(auto x:B)printf("%llu ",x);
//	printf("\n");
	bool flag1=check(A,B);
	reverse(B.begin(),B.end());
//	for(auto x:A)printf("%llu ",x);
//	printf("\n");
//	for(auto x:B)printf("%llu ",x);
//	printf("\n");
	bool flag2=check(A,B);
	if(flag1||flag2){
		printf("Yes\n");
	}else {
		printf("No\n");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 14604kb

input:

4
1 2
2 3
2 4
3 4
1 2
1 3
1 4
3 4

output:

Yes

result:

ok answer is YES

Test #2:

score: 0
Accepted
time: 3ms
memory: 14604kb

input:

4
1 2
2 3
3 4
1 4
1 2
1 3
1 4
3 4

output:

No

result:

ok answer is NO

Test #3:

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

input:

6
1 2
1 3
2 5
2 6
3 5
4 6
1 5
1 6
2 4
2 5
2 6
3 4

output:

Yes

result:

ok answer is YES

Test #4:

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

input:

903
835 491
695 797
411 56
636 367
122 715
775 564
199 77
31 593
654 460
330 25
555 345
36 527
768 760
378 753
291 51
676 73
227 883
310 389
656 259
603 836
369 901
347 231
543 259
66 772
301 592
711 738
507 499
425 462
27 458
257 328
628 83
184 645
805 495
491 311
635 874
615 259
39 193
715 673
636...

output:

No

result:

ok answer is NO

Test #5:

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

input:

700
520 12
414 245
592 324
396 343
365 93
611 99
163 524
327 310
436 373
646 392
642 15
698 393
599 682
427 341
383 14
218 330
453 441
647 223
14 26
36 118
229 27
56 604
497 177
621 352
178 349
372 257
45 533
44 407
110 343
66 468
564 253
200 27
80 62
50 201
130 5
190 12
140 643
635 130
352 465
223 ...

output:

No

result:

ok answer is NO

Test #6:

score: 0
Accepted
time: 3ms
memory: 15072kb

input:

350
40 299
79 166
204 324
281 292
63 25
326 188
279 70
64 153
145 121
93 188
283 187
339 1
11 10
330 146
124 45
295 65
208 60
131 39
328 21
181 78
276 5
121 62
81 136
248 78
51 115
87 159
346 338
251 133
306 64
298 183
161 42
14 207
5 73
259 89
269 194
334 129
118 82
50 314
246 72
180 68
166 283
249...

output:

Yes

result:

ok answer is YES

Test #7:

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

input:

506
353 288
61 487
475 353
14 427
103 227
280 13
425 238
10 58
173 240
388 498
12 252
260 326
291 385
32 182
429 10
351 88
12 442
449 224
167 14
5 394
133 492
133 447
199 451
220 468
455 10
472 371
128 392
317 240
36 497
144 149
16 224
272 260
260 323
411 297
361 116
494 46
286 116
483 348
96 337
48...

output:

No

result:

ok answer is NO

Test #8:

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

input:

971
648 284
474 937
225 857
112 843
534 919
750 195
81 705
20 524
745 818
410 187
591 423
567 536
945 69
166 165
168 536
348 536
466 914
3 37
23 745
952 662
110 873
153 915
398 539
242 291
548 749
881 836
155 503
599 202
836 186
54 589
361 368
690 387
578 65
153 104
284 456
327 802
706 800
153 950
2...

output:

Yes

result:

ok answer is YES

Test #9:

score: 0
Accepted
time: 3ms
memory: 14880kb

input:

59
17 6
18 55
16 59
35 1
28 2
41 28
58 30
28 29
21 8
20 10
24 27
13 29
58 26
13 22
12 35
8 13
36 15
1 33
5 16
58 11
16 23
52 45
29 57
16 48
31 38
1 27
17 41
14 37
54 50
13 33
59 27
32 13
2 3
13 26
13 34
41 7
54 1
35 43
3 44
31 18
54 51
35 14
39 59
20 29
34 46
59 56
25 32
12 47
25 6
53 26
29 42
32 55...

output:

No

result:

ok answer is NO

Test #10:

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

input:

286
165 14
142 274
11 169
103 182
219 210
61 78
112 273
176 220
29 5
80 254
228 127
223 198
186 74
218 198
272 157
62 251
210 267
142 84
18 276
124 118
126 286
87 53
43 232
60 282
164 274
137 111
198 104
98 211
42 236
94 54
154 168
202 142
124 107
182 165
20 5
239 230
135 171
184 75
212 273
178 41
2...

output:

Yes

result:

ok answer is YES

Test #11:

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

input:

39
16 15
8 4
15 21
36 26
4 6
30 11
3 36
15 31
33 34
5 36
3 19
28 37
27 36
27 25
29 9
11 1
39 18
3 20
2 5
9 21
7 39
32 27
34 21
17 21
3 29
5 15
15 4
36 12
23 27
2 10
6 38
24 36
35 6
14 22
13 14
11 26
5 39
14 11
15 37
1 37
26 5
37 30
13 9
7 14
10 6
11 28
14 33
35 15
8 11
17 27
31 18
30 15
17 13
16 3
1...

output:

No

result:

ok answer is NO

Test #12:

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

input:

650
4 317
341 320
303 241
537 130
365 247
225 255
646 541
499 123
464 144
161 310
139 209
387 151
435 509
294 531
256 461
276 441
181 165
249 305
229 178
90 84
549 5
456 232
587 326
183 407
540 167
207 564
516 465
463 529
149 30
533 497
246 153
9 461
325 301
606 599
274 48
296 389
101 391
394 628
27...

output:

No

result:

ok answer is NO

Test #13:

score: 0
Accepted
time: 3ms
memory: 13588kb

input:

288
91 109
61 38
71 79
114 201
22 133
200 110
88 53
250 42
195 147
239 266
271 116
83 40
178 21
144 254
18 238
204 89
16 88
118 219
219 116
275 34
76 288
234 248
198 49
228 256
29 27
85 132
163 49
190 144
84 255
65 236
185 162
14 70
243 263
220 234
153 205
187 283
96 221
39 166
199 148
7 265
202 229...

output:

No

result:

ok answer is NO

Test #14:

score: 0
Accepted
time: 44ms
memory: 18744kb

input:

116871
39075 32573
116166 73891
46785 26557
109712 67026
96634 74215
20928 27705
74117 37505
41693 113891
93879 112142
29569 17203
22934 79495
70087 92907
28702 82575
21339 116746
66068 100787
91238 12681
48500 112852
80581 76454
92974 88524
24260 112857
36444 115587
93557 74966
48402 38197
21346 74...

output:

Yes

result:

ok answer is YES

Test #15:

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

input:

5764
735 2245
5261 4983
1720 619
3184 2731
2265 4346
1574 2569
5493 4325
4342 4815
958 1651
1818 4830
4898 3423
5684 265
615 1576
3867 508
3912 1491
2895 3135
2291 455
3531 4583
4149 4638
5625 1899
2053 2323
3786 3186
3267 1392
2842 1627
5757 5201
1162 5081
5476 2077
4033 5656
4592 2643
2746 4512
85...

output:

Yes

result:

ok answer is YES

Test #16:

score: 0
Accepted
time: 16ms
memory: 14476kb

input:

29536
27536 26260
10153 13958
24023 8396
12812 13954
13107 19921
11129 25037
2374 4793
28271 13721
19185 5317
21094 29053
13174 2179
16984 1885
10185 27572
10330 8897
29395 20291
6609 7373
12202 3833
13038 20212
2515 24841
11439 2980
14619 16781
8181 18057
8965 28845
22994 27293
28675 21436
19992 24...

output:

Yes

result:

ok answer is YES

Test #17:

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

input:

165208
73984 74911
137816 51572
101919 670
11442 49473
161121 162594
23452 155347
87190 76918
58502 140135
112901 95605
137460 86254
69964 110530
1464 75732
59633 141728
156583 71372
57210 13672
63130 151423
93050 82426
157597 83800
53310 12654
106236 77296
129602 112230
110840 48564
108727 153700
1...

output:

No

result:

ok answer is NO

Test #18:

score: 0
Accepted
time: 62ms
memory: 20208kb

input:

142678
36083 126449
79407 99265
139071 44450
13153 118675
52986 26655
76115 138059
31514 75257
114550 48160
59787 111382
123300 126840
133984 98478
56133 25184
14209 116943
58293 76570
112975 125137
79515 26183
43334 90762
118048 31514
91708 67838
71253 110197
132723 81682
69695 107391
89547 123688
...

output:

No

result:

ok answer is NO

Test #19:

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

input:

45195
41902 12031
7495 14163
28113 33738
31183 8075
30015 29708
25514 39203
41047 44275
59 20623
22601 17647
5919 38696
2994 35788
7772 1243
15498 16332
23341 7650
39203 34917
25882 24621
22865 16940
18922 10693
12496 6763
20623 35356
38551 697
27074 19867
42844 2534
31118 43276
25815 31183
20794 42...

output:

Yes

result:

ok answer is YES

Test #20:

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

input:

21007
17047 1364
6127 463
9139 7027
4290 17796
16555 2623
568 14105
6420 16830
2656 11336
17486 11771
11259 16896
2656 4272
11969 6127
131 9997
18748 10872
11819 5186
14309 19012
9050 14371
18744 14105
20185 3378
4452 20089
1263 11626
18234 15490
4623 12010
19136 9820
6550 2165
6095 9564
20118 9997
...

output:

No

result:

ok answer is NO

Test #21:

score: 0
Accepted
time: 53ms
memory: 18804kb

input:

107464
76154 10587
35783 74082
1649 62833
60094 58802
9398 26303
7688 42924
8598 67244
21208 4946
98346 84157
68017 22886
35309 3317
58681 42998
35219 65971
19533 62162
101250 18885
94163 43127
79234 100293
27774 28585
32589 79723
59009 60420
46924 20427
96548 35919
79307 23226
73748 45912
45849 406...

output:

Yes

result:

ok answer is YES

Test #22:

score: 0
Accepted
time: 103ms
memory: 21764kb

input:

192707
116571 143455
19475 17085
132054 130807
17931 2944
79824 112544
135126 11421
127572 78348
138239 191752
166625 21157
170366 14014
62357 103408
188682 190397
101424 12084
61521 70883
134768 107733
81064 180439
14750 33242
59796 18422
39368 40410
107914 29864
10107 124368
80687 71335
151286 148...

output:

Yes

result:

ok answer is YES

Test #23:

score: 0
Accepted
time: 32ms
memory: 15740kb

input:

88578
47565 79203
12280 83272
72176 46300
57337 57216
36872 14057
45906 46739
49097 42502
8573 67260
86639 4963
44905 84306
74127 46529
76106 28823
73526 4963
22396 83272
29888 61927
85628 11217
12250 19919
75058 44328
72862 62753
860 65086
72862 8156
42557 59513
34970 58630
52190 77530
23333 47565
...

output:

Yes

result:

ok answer is YES

Test #24:

score: 0
Accepted
time: 90ms
memory: 21104kb

input:

198221
6680 189881
135933 131050
150085 103607
116430 190298
3788 56626
127874 75891
35061 26810
114264 107965
11971 189888
29482 44566
108848 156837
34189 48744
78966 5613
43211 110640
181196 102317
129259 57731
107647 164716
1027 32727
75009 14218
32132 131977
58733 38827
38369 167199
92170 49566
...

output:

No

result:

ok answer is NO

Test #25:

score: 0
Accepted
time: 110ms
memory: 22936kb

input:

198882
83649 34859
166666 86398
7190 140616
110316 47334
186750 99168
180766 113942
150794 183293
68546 183749
10470 17402
176320 103485
96878 8360
29147 125203
11426 119370
85857 164237
66952 149427
196130 153946
100633 102066
107069 73940
47356 40530
78875 114183
48652 171754
30082 185205
91660 91...

output:

Yes

result:

ok answer is YES

Test #26:

score: 0
Accepted
time: 88ms
memory: 22100kb

input:

199359
35003 40261
171279 86565
20082 37613
188779 101180
162073 134205
35943 168817
56141 124237
27677 137657
8001 24354
116498 53198
34559 47118
27342 57373
197493 24488
117368 182225
64826 97305
20341 172687
74600 82109
148198 99027
167686 142671
97846 4245
87709 176925
183385 196597
35319 76296
...

output:

No

result:

ok answer is NO

Test #27:

score: 0
Accepted
time: 108ms
memory: 20660kb

input:

198643
1122 139850
127259 6134
182667 188448
132011 144215
15691 164249
59802 194905
38393 96513
67480 124527
96885 198211
65241 194822
81451 81042
168396 84754
146880 76468
130296 34201
109556 158496
64847 97285
184108 185350
41222 193338
94413 77951
78461 50229
90956 53930
126335 187943
175955 155...

output:

Yes

result:

ok answer is YES

Test #28:

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

input:

198532
51024 37915
71323 175470
44265 118230
107101 192793
100483 58728
9509 151130
191948 62654
79087 113823
172744 24995
180939 184656
57963 150247
106210 189612
102863 56361
142536 95024
157490 132474
46201 1347
94612 67995
124499 167052
127895 79964
27177 197494
55199 13814
118527 97480
4055 358...

output:

No

result:

ok answer is NO

Test #29:

score: 0
Accepted
time: 109ms
memory: 21036kb

input:

199906
80953 162530
102710 186291
70324 136041
40468 72843
135414 74509
92229 35712
108702 124870
117620 2435
122075 198031
71127 102441
186711 4200
47727 109237
119099 81850
144090 170847
69459 83083
185158 87614
135639 195046
67547 192998
46476 39977
136533 186437
130794 49258
108466 6129
138923 6...

output:

Yes

result:

ok answer is YES

Test #30:

score: 0
Accepted
time: 104ms
memory: 21904kb

input:

198424
87140 827
178244 50615
83421 170983
83108 161930
171818 80455
39569 147123
41079 95899
116552 36949
34395 123760
154413 187309
29213 85611
43411 197156
182070 162769
110224 74775
110371 139509
111247 122655
145258 86442
184544 127176
102236 167315
172798 100659
56657 139939
30069 16516
93387 ...

output:

No

result:

ok answer is NO

Test #31:

score: 0
Accepted
time: 99ms
memory: 21964kb

input:

199213
7250 29085
148653 20692
25815 187490
169870 169976
170163 77945
55262 145179
153512 40824
157881 175254
143750 151366
196147 35057
119219 77195
196046 166023
163184 96870
67617 161326
198080 21939
64914 98457
99678 134354
59528 130819
37479 127701
62916 100376
183690 100946
136651 50202
91190...

output:

No

result:

ok answer is NO

Test #32:

score: 0
Accepted
time: 87ms
memory: 21220kb

input:

198364
125238 188329
44862 87526
149671 145127
170003 186149
138956 116020
47136 33142
125835 11031
184523 6097
6380 80078
108460 80184
1807 44367
72806 36763
125616 109717
135297 47516
179571 104936
52394 170531
84283 109873
180037 143949
20426 178274
12501 89226
189398 72481
142409 162843
49330 35...

output:

Yes

result:

ok answer is YES

Test #33:

score: 0
Accepted
time: 90ms
memory: 21172kb

input:

198973
6667 60934
168915 70715
112102 139512
154841 160045
38807 12249
94361 82934
64756 95338
87848 76019
182500 128204
83225 174007
128717 170036
20973 145767
54079 161037
87220 146911
126924 153180
11096 151211
100738 66776
109181 68935
177097 153606
126777 101078
193874 2112
20337 119809
23456 1...

output:

Yes

result:

ok answer is YES

Test #34:

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

input:

189678
189197 96143
42859 157767
136657 51042
77859 145128
83484 22310
45267 179665
105625 32628
17239 58830
134504 45615
149675 152589
68394 148702
150120 153398
181353 179733
147453 75671
189217 159365
9476 142708
120609 105850
41182 43734
144146 81922
126092 163440
2368 105811
13674 151802
126006...

output:

Yes

result:

ok answer is YES

Test #35:

score: 0
Accepted
time: 93ms
memory: 21404kb

input:

197904
144301 103219
177001 175163
159289 162276
135465 151981
3504 49503
77641 59017
87774 28065
59771 84705
34487 17159
138506 163020
90937 71544
162499 6148
54315 142515
124290 3061
79252 39730
88869 142954
38315 6899
47665 15538
65566 17008
81826 171027
172085 115781
54174 107912
165177 95390
16...

output:

No

result:

ok answer is NO

Test #36:

score: 0
Accepted
time: 98ms
memory: 21820kb

input:

199221
117135 70893
171451 192080
155435 111580
144480 132198
180441 23471
147008 161896
132880 135634
88363 54623
127097 185669
29999 71138
95251 77736
137562 142792
54705 133408
25828 16390
7130 151115
176822 127458
68549 69757
163027 156450
145209 26926
7288 124496
101206 150947
36520 53399
57539...

output:

No

result:

ok answer is NO

Test #37:

score: 0
Accepted
time: 82ms
memory: 21144kb

input:

190095
139298 174013
148426 21748
119485 85869
163984 126820
129044 187015
106539 69195
161167 136622
91353 134843
141546 117186
167384 154605
829 58126
124374 174198
159644 99451
76843 76109
82849 107821
15449 20607
98278 133768
18664 53204
141280 105170
132665 15165
124518 59812
40278 68119
50608 ...

output:

Yes

result:

ok answer is YES

Test #38:

score: 0
Accepted
time: 99ms
memory: 22960kb

input:

198088
96400 63163
98680 22456
60690 129394
32609 145855
74567 130444
43913 127868
47367 173923
170667 93671
194121 20021
10782 82379
15845 115809
55933 143409
106812 167787
111455 38683
71543 107011
196541 82820
82457 91327
48217 179543
136421 163495
141739 181029
21134 79120
152792 185425
147522 1...

output:

No

result:

ok answer is NO

Test #39:

score: 0
Accepted
time: 94ms
memory: 20724kb

input:

199232
101642 75821
55092 72930
155003 24143
42138 104248
109802 144688
18389 68885
161338 130365
100566 105949
76710 68122
7807 183613
151616 22489
182033 111155
185595 96489
84007 153301
88767 89725
99189 137820
68199 147029
138781 36378
69270 61370
153587 83925
170301 143253
27128 90978
23558 198...

output:

No

result:

ok answer is NO

Test #40:

score: 0
Accepted
time: 98ms
memory: 21508kb

input:

198535
176510 1983
121090 138173
100785 40431
190871 70846
28647 70910
151580 51405
19729 55258
186437 189416
7716 126525
78897 121534
28433 164208
72734 7550
72637 178565
149235 94966
7838 196084
88617 118892
114477 154026
52733 175919
105467 103629
187587 115345
91113 94268
187346 78438
82031 9416...

output:

No

result:

ok answer is NO

Test #41:

score: 0
Accepted
time: 105ms
memory: 21352kb

input:

199584
194505 181801
46458 166741
119472 117590
175151 134548
72875 122927
38679 162758
24260 52539
75471 92941
189436 25782
157492 176879
91906 95639
48499 184040
17687 1720
129521 96363
69861 74842
52641 157615
70981 67198
78168 45969
65825 31397
9424 158384
187491 77407
81429 97893
5362 167076
80...

output:

Yes

result:

ok answer is YES

Test #42:

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

input:

198359
182024 32124
183915 95125
154285 25743
114706 31135
105206 23807
97683 16348
113543 12515
24853 21118
178494 155957
48738 138757
120385 187500
78064 22224
104288 133580
98900 155435
2867 155271
40552 56621
179066 138896
62147 167697
150644 88280
157865 175849
90953 133638
192915 73273
160435 ...

output:

No

result:

ok answer is NO

Test #43:

score: 0
Accepted
time: 90ms
memory: 23608kb

input:

198820
126924 11022
196142 81203
6997 41793
177625 48675
198533 119951
164485 33877
43952 16949
151913 68755
162333 119635
37254 92858
173801 58092
62481 168748
44028 141483
83087 29305
27432 83830
108716 154732
4708 147030
124360 40563
145896 144131
177634 9886
108057 149574
178740 83932
156417 417...

output:

Yes

result:

ok answer is YES

Test #44:

score: 0
Accepted
time: 78ms
memory: 20588kb

input:

198272
37984 109173
3172 140988
120275 35181
119796 45151
115899 89515
160713 102089
142645 87328
42725 168702
121210 100271
16925 40923
174810 31698
120177 144073
36085 179759
110578 58616
21236 149988
136525 63899
37946 44972
139069 121400
59117 66571
54555 69847
31216 69467
137491 36891
164505 11...

output:

Yes

result:

ok answer is YES

Test #45:

score: 0
Accepted
time: 84ms
memory: 21832kb

input:

199557
174836 148818
18889 162485
28112 94695
89247 54103
145802 144712
28112 144736
61016 128234
139911 133854
90647 1834
159492 174720
177814 48062
114623 157297
125689 73809
125577 145802
40345 159181
18768 105612
23759 128671
94097 73506
145530 96624
172580 98017
71599 19900
151794 80382
124717 ...

output:

Yes

result:

ok answer is YES

Test #46:

score: 0
Accepted
time: 82ms
memory: 21800kb

input:

199796
198494 3347
184574 194629
192180 45925
134047 140689
152981 129419
192684 120506
156129 112478
8025 177576
64421 183506
38449 161306
120506 172248
60335 49770
114357 194629
48327 45225
20869 79166
64120 142997
180436 3784
115207 177631
154238 124844
166982 75670
139662 138658
158240 174539
48...

output:

No

result:

ok answer is NO

Test #47:

score: 0
Accepted
time: 98ms
memory: 21792kb

input:

198830
60350 196523
100600 138906
546 3499
132560 9898
12834 89333
46444 11671
129222 131211
99846 76289
17950 194487
98337 153416
3275 136016
108432 80347
119572 180679
115074 145429
81477 172407
22778 161927
109254 190484
16105 36942
88880 132593
195099 175203
72748 30424
49939 148085
59381 97748
...

output:

No

result:

ok answer is NO

Test #48:

score: 0
Accepted
time: 74ms
memory: 21124kb

input:

198726
46668 161844
71158 182058
47253 83795
139043 74440
33711 36369
172772 179855
84121 88011
92796 51191
77509 83395
2649 192852
95080 193268
150758 64660
143248 32836
23958 18477
43922 20988
166129 52885
54623 154763
128181 26164
21431 25124
16595 157063
75706 195545
17540 130644
88011 6525
4054...

output:

Yes

result:

ok answer is YES

Test #49:

score: 0
Accepted
time: 94ms
memory: 21116kb

input:

199141
98855 77034
182227 104106
103932 64884
107524 197570
93111 26771
65211 43513
60998 153695
79101 155620
52946 64070
91081 110558
193184 115970
150518 55855
12356 178438
20742 79029
152877 62395
114256 2749
178959 21751
168318 91365
164000 162296
111236 124817
142380 179465
140923 118010
198391...

output:

Yes

result:

ok answer is YES

Test #50:

score: 0
Accepted
time: 96ms
memory: 21452kb

input:

199908
140891 154670
4149 11979
121596 22563
17692 79010
80114 55102
190252 6659
31905 88193
54703 80888
59617 171857
70818 193981
135709 138704
158406 178777
13756 1413
88390 113458
48365 174693
96737 13856
20732 68465
77830 122809
51028 18070
19556 98359
122743 199644
118372 184611
168061 15063
13...

output:

Yes

result:

ok answer is YES

Test #51:

score: 0
Accepted
time: 90ms
memory: 21120kb

input:

198496
124813 157749
127479 127641
146601 107245
93429 122444
32543 133621
114842 147283
86284 198258
29315 94381
164346 38195
124414 50506
81657 181802
177877 78398
115927 93948
123510 9612
134605 118537
6355 189730
56561 22435
51622 148355
5768 85225
75833 159756
122420 16686
27845 138186
194629 2...

output:

No

result:

ok answer is NO

Test #52:

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

input:

198218
49475 127350
116122 174910
57075 84520
68490 169436
114435 155426
100713 136952
189303 456
75079 32726
58922 57212
116065 76940
190719 53184
26380 178829
146093 24220
24339 103462
149745 154576
9525 76974
195198 110794
4158 35903
6834 86739
40952 103892
175235 186119
139504 165198
182735 6561...

output:

Yes

result:

ok answer is YES

Test #53:

score: 0
Accepted
time: 113ms
memory: 20656kb

input:

198689
35012 109189
145427 7040
10565 152747
731 74551
6745 49227
98031 175850
23410 152758
44667 147814
130663 145522
103568 25912
39086 31956
100515 92588
193055 134164
22535 38900
65672 118715
41322 56727
51319 70857
136037 118298
134810 183741
93526 115377
193407 131434
65768 152679
157024 1622
...

output:

No

result:

ok answer is NO

Test #54:

score: 0
Accepted
time: 40ms
memory: 24724kb

input:

122551
72004 36193
48520 23572
103754 42865
25247 58897
67480 8975
113031 100465
81061 3089
105904 16048
117120 94222
18675 91140
90780 62779
55527 64211
97372 94257
82262 23218
73506 19881
98328 100652
66689 31434
7645 98114
35367 78233
20478 36218
104952 5644
38003 5716
27045 354
4186 79333
100928...

output:

No

result:

ok answer is NO

Test #55:

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

input:

50619
19313 8672
24263 8306
11317 47246
23743 26532
31384 35496
32672 48038
35210 2286
48094 5640
26454 25650
46699 14144
11018 45368
8115 18742
49433 18225
22287 28927
33595 49197
5310 38064
22774 38874
43038 5816
9754 40252
18123 44741
47000 225
35556 35977
44392 28048
30430 37592
32992 39626
9720...

output:

No

result:

ok answer is NO

Test #56:

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

input:

177087
136310 104794
15010 173351
104802 138920
13582 38362
74565 19467
23777 72172
105479 24256
116143 15823
120985 76073
1898 159556
54180 135201
9631 46918
115979 55625
65548 1146
43007 135371
102478 169249
77564 92120
60156 124090
16798 107229
164527 124067
94295 99573
78158 3409
115905 156697
1...

output:

Yes

result:

ok answer is YES

Test #57:

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

input:

20425
11733 15089
19003 16199
1826 497
9657 5523
19792 13752
6477 9126
2047 18317
18535 3770
9375 14607
5550 14554
6333 19596
7979 19715
7555 369
888 4905
1329 11979
11519 17970
3383 4771
10209 15122
13389 4
15016 2121
12608 8257
3584 10015
5278 8257
9993 5619
20351 12742
4383 5150
13130 14932
13949...

output:

Yes

result:

ok answer is YES

Test #58:

score: 0
Accepted
time: 57ms
memory: 25900kb

input:

133965
119235 124598
1594 124305
113600 2147
58334 33012
51738 80397
36118 73627
64682 7046
5541 11142
69561 58128
120205 41761
80843 25850
78778 114348
122877 75029
35659 18083
26141 90634
116955 49532
55699 70968
16835 47544
92739 82183
92028 74316
58153 7429
58007 23772
60101 49022
60927 84348
84...

output:

No

result:

ok answer is NO

Test #59:

score: 0
Accepted
time: 21ms
memory: 22176kb

input:

76751
39433 42315
27219 15492
3567 8191
29382 64073
39790 51059
39195 49794
51601 21930
57177 756
65671 65281
59286 48598
68080 36828
32856 15065
6903 42355
70582 74795
74549 938
17623 67019
52725 22748
7225 18484
31024 2147
64297 51380
46627 61994
67862 32741
63558 76186
17482 15440
11944 54077
557...

output:

Yes

result:

ok answer is YES

Test #60:

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

input:

48040
30409 419
36272 32660
39912 6712
2718 12041
725 45938
19584 42792
37659 39703
880 37735
47981 26908
11427 7144
2584 31351
39024 6911
35646 15361
30396 45960
647 32307
19450 5436
32268 30275
10721 24224
30986 39145
26378 5180
9176 10578
6675 12523
23917 43812
33481 35676
16018 45570
23379 41928...

output:

No

result:

ok answer is NO

Test #61:

score: 0
Accepted
time: 27ms
memory: 23744kb

input:

95410
55962 93264
84848 35589
48629 38025
45947 91863
18740 8329
16704 10487
51385 33748
3210 78573
49180 4872
68852 40253
2193 82300
30087 25078
74577 44535
82888 57894
72420 38885
95106 89594
12701 35593
17746 49319
32170 68839
21759 1939
70826 23202
85835 83670
10464 30310
14914 16887
40681 86309...

output:

No

result:

ok answer is NO

Test #62:

score: 0
Accepted
time: 75ms
memory: 28540kb

input:

168382
105677 47365
134880 34559
96666 1070
60408 80243
106445 156529
38701 140361
61955 47316
32964 92098
59324 37123
1562 156133
64034 152874
94985 127996
119885 146537
139768 103575
136166 79610
168127 115810
72653 138077
92557 98658
154305 49978
68158 112268
33154 152160
68637 36484
110134 46465...

output:

Yes

result:

ok answer is YES

Test #63:

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

input:

117629
46415 53903
78352 5726
57317 54994
22588 27792
25326 1521
106208 78551
68000 12616
94359 25819
9634 32579
53510 6724
87408 41507
79747 80942
90621 7350
38774 77168
48803 102511
61231 33590
58011 100502
79378 19805
6198 62867
57380 86218
92701 38876
36938 7370
53348 59731
48355 26054
64616 540...

output:

No

result:

ok answer is NO

Test #64:

score: 0
Accepted
time: 3ms
memory: 13312kb

input:

12
1 2
2 3
2 4
3 5
4 6
4 7
5 8
5 9
7 10
1 11
11 12
12 1
1 2
2 3
2 4
3 5
3 6
4 7
5 8
5 9
7 10
1 11
11 12
12 1

output:

No

result:

ok answer is NO