QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#331907#3561. Capital CityKevin5307100 ✓462ms42232kbC++202.3kb2024-02-18 22:09:432024-02-18 22:09:44

Judging History

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

  • [2024-02-18 22:09:44]
  • 评测
  • 测评结果:100
  • 用时:462ms
  • 内存:42232kb
  • [2024-02-18 22:09:43]
  • 提交

answer

//Author: Kevin5307
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
namespace _kv_hash
{
	const ull mask=std::chrono::steady_clock::now().time_since_epoch().count();
	ull shift(ull x)
	{
		x^=mask;
		x^=x<<13;
		x^=x>>7;
		x^=x<<17;
		x^=mask;
		return x;
	}
}
using namespace _kv_hash;
const int maxn=200200;
vector<int> G[maxn];
int color[maxn];
bool flag[maxn];
vector<int> nodes;
int siz[maxn],mx[maxn];
int f[maxn];
void dfs2(int u,int fa)
{
	f[u]=fa;
	siz[u]=1;
	mx[u]=0;
	nodes.pb(u);
	for(auto v:G[u])
		if(v!=fa&&!flag[v])
		{
			dfs2(v,u);
			siz[u]+=siz[v];
			mx[u]=max(mx[u],siz[v]);
		}
}
int ans=inf;
vector<int> vec[maxn];
bool vis[maxn];
int cc[maxn];
void dfs(int root)
{
	nodes.clear();
	dfs2(root,0);
	for(auto u:nodes)
		mx[u]=max(mx[u],siz[root]-siz[u]);
	for(auto u:nodes)
		if(mx[u]<mx[root])
			root=u;
	for(auto u:nodes)
		vec[color[u]].pb(u);
	dfs2(root,0);
	bool fl=1;
	queue<int> q;
	int cnt=0;
	for(auto u:vec[color[root]])
	{
		vis[u]=1;
		q.push(u);
	}
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
//		cerr<<x<<endl;
		if(cc[color[x]]!=sz(vec[color[x]]))
			fl=0;
		if(f[x]&&!vis[f[x]])
		{
			int p=f[x];
			cnt++;
			for(auto v:vec[color[p]])
			{
				vis[v]=1;
				q.push(v);
			}
		}
	}
//	cerr<<endl;
	if(fl)
		ans=min(ans,cnt);
	for(auto u:nodes)
	{
		vis[u]=0;
		vec[color[u]].clear();
	}
	flag[root]=1;
	for(auto v:G[root])
		if(!flag[v])
			dfs(v);
}
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		G[u].pb(v);
		G[v].pb(u);
	}
	for(int i=1;i<=n;i++)
	{
		scanf("%d",color+i);
		cc[color[i]]++;
	}
	dfs(1);
	printf("%d\n",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 2ms
memory: 5932kb

input:

20 3
16 10
10 3
18 2
4 5
8 6
11 12
2 14
1 2
6 3
1 11
1 4
7 20
3 2
9 7
3 13
15 19
5 7
17 6
12 15
2
2
1
1
1
2
2
1
3
3
1
3
1
3
2
2
1
2
2
3

output:

2

result:

ok single line: '2'

Test #2:

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

input:

20 3
13 1
5 17
14 1
15 2
19 17
7 9
4 6
12 5
15 18
1 2
16 20
3 4
11 8
2 7
9 16
5 1
3 2
5 8
7 10
1
2
3
2
1
3
3
3
2
3
3
3
3
2
2
1
3
1
2
3

output:

2

result:

ok single line: '2'

Test #3:

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

input:

20 3
7 6
9 13
12 11
16 6
20 8
14 17
2 3
9 11
4 2
2 1
12 14
15 8
18 16
9 19
10 4
2 9
8 3
4 5
5 6
2
2
2
3
2
3
3
1
2
2
1
2
1
1
1
2
3
2
3
3

output:

2

result:

ok single line: '2'

Test #4:

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

input:

20 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
10
9
8
5
6
7
1
2
3
4
5
6
7
1
2
3
4
8
9
10

output:

6

result:

ok single line: '6'

Test #5:

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

input:

20 10
19 6
6 3
3 18
18 20
20 11
11 7
7 17
17 14
14 9
9 13
13 5
5 12
12 4
4 10
10 2
2 16
16 15
15 8
8 1
8
3
2
6
7
5
7
5
1
1
4
9
4
6
2
10
9
10
8
3

output:

4

result:

ok single line: '4'

Test #6:

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

input:

20 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
10
9
8
7
6
5
4
3
2
1
2
1
3
4
5
6
7
8
9
10

output:

1

result:

ok single line: '1'

Test #7:

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

input:

20 10
20 9
9 17
17 4
15 4
15 16
3 19
3 16
19 6
19 2
19 7
6 11
11 8
8 13
13 10
10 5
5 14
14 12
12 1
1 18
10
2
7
9
10
3
2
3
7
1
4
1
4
8
5
9
6
8
6
5

output:

1

result:

ok single line: '1'

Test #8:

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

input:

20 10
18 12
12 11
9 11
9 19
8 7
8 19
16 7
16 20
3 6
3 20
6 15
15 2
2 14
14 10
10 13
13 4
4 5
5 17
17 1
9
8
6
9
2
8
4
3
6
2
5
10
7
1
1
10
7
3
5
4

output:

1

result:

ok single line: '1'

Test #9:

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

input:

20 10
13 15
15 12
15 17
15 5
12 16
16 4
18 4
18 11
2 14
2 11
14 3
3 9
9 8
8 6
6 1
1 7
7 19
19 10
10 20
9
6
5
7
8
1
3
5
4
9
7
6
2
4
10
2
8
10
1
3

output:

1

result:

ok single line: '1'

Test #10:

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

input:

1 1
1

output:

0

result:

ok single line: '0'

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #11:

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

input:

2000 250
1875 208
1788 262
675 397
779 1033
185 238
469 70
650 1600
146 1093
248 1604
167 504
914 1041
1263 1427
131 68
1759 81
114 170
676 923
489 95
1747 107
133 91
582 164
35 1315
592 740
888 475
1230 117
818 522
1108 52
1276 1891
4 1
212 1917
1298 662
642 391
7 5
1035 1804
856 656
119 99
385 355...

output:

244

result:

ok single line: '244'

Test #12:

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

input:

2000 250
37 10
1592 1517
607 125
77 194
56 1371
1470 1162
1004 323
309 567
925 188
389 509
1644 1619
286 1000
144 1539
244 900
644 28
528 26
251 140
183 81
764 248
21 775
191 25
1178 819
29 94
1166 934
271 1066
3 27
316 1063
901 91
219 64
853 983
13 5
180 70
394 992
1537 1193
188 1557
618 1613
116 7...

output:

246

result:

ok single line: '246'

Test #13:

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

input:

2000 250
1155 1655
183 259
19 685
845 610
1139 1514
665 549
199 272
516 1425
510 499
721 1497
316 497
452 1417
136 379
12 10
99 281
1850 1671
275 356
786 306
108 1833
1216 238
1914 210
1908 1158
771 893
41 635
67 988
202 726
16 55
671 577
199 306
731 1723
281 293
115 106
1365 374
1239 658
106 194
47...

output:

245

result:

ok single line: '245'

Test #14:

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

input:

2000 250
1580 249
640 178
2 1
615 1054
112 816
949 22
57 793
407 950
865 416
1903 1229
975 365
455 1355
1494 98
1565 497
1244 780
1323 1074
1588 138
1503 1145
447 352
1264 1880
951 1564
821 393
232 569
1023 572
158 255
571 1257
1693 704
1816 309
726 255
570 528
284 471
1430 569
26 1408
357 1902
452 ...

output:

245

result:

ok single line: '245'

Test #15:

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

input:

2000 758
1645 394
394 842
842 1368
1368 89
89 805
805 351
351 811
811 1752
1752 1787
1787 1219
1219 1299
1299 822
822 878
878 1582
1582 807
807 1371
1371 1142
1645 924
1645 282
282 834
282 74
74 1744
74 1834
1834 1309
1834 1009
1009 870
1009 1163
1163 1879
1163 25
25 1967
25 1779
1779 1974
1779 268
...

output:

7

result:

ok single line: '7'

Test #16:

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

input:

2000 884
178 1218
1218 1351
1351 1815
1815 98
98 343
343 1095
1095 862
862 719
719 1071
1071 1231
1231 1366
1366 72
72 816
178 1470
178 1696
1696 298
1696 1448
1448 1172
1448 1006
1006 514
1006 647
647 544
647 1707
1707 872
1707 563
563 1049
563 1428
1428 665
1428 716
716 734
716 1195
1195 935
1195 ...

output:

6

result:

ok single line: '6'

Test #17:

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

input:

2000 503
32 1635
1635 1645
1645 557
557 40
40 126
126 1165
1165 888
888 567
567 913
913 702
702 1242
1242 1385
1385 12
12 1224
1224 1688
1688 1189
1189 620
620 1778
1778 989
989 1914
1914 727
727 17
17 921
921 728
728 1601
1601 941
941 29
29 1692
1692 945
945 815
815 757
757 1413
1413 1539
1539 161
...

output:

1

result:

ok single line: '1'

Test #18:

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

input:

2000 505
393 839
839 134
134 1135
1135 288
288 1769
1769 1658
1658 147
147 523
523 276
276 779
779 263
263 1152
1152 1858
1858 1556
1556 1353
1353 1724
1724 1951
1951 1903
1903 1761
1761 1775
1775 122
122 355
355 43
43 368
368 300
300 175
175 947
947 1239
1239 1653
1653 373
373 1448
1448 1621
1621 7...

output:

3

result:

ok single line: '3'

Test #19:

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

input:

2000 511
16 767
767 1917
1917 555
555 815
815 629
629 211
211 101
101 128
128 543
543 1548
1548 1909
1909 958
958 841
841 43
43 910
910 881
881 148
148 1263
1263 1117
1117 1710
1710 1860
1860 1395
1395 1
1 1740
1740 107
107 1717
1717 1553
1553 1397
1397 552
552 1355
1355 1569
1569 567
567 1265
1265 ...

output:

9

result:

ok single line: '9'

Test #20:

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

input:

2000 503
788 1186
1186 1179
1179 1230
1230 1639
1639 838
838 522
522 227
227 1293
1293 1710
1710 1976
1976 558
558 1559
1559 1167
1167 1429
1429 733
733 346
346 1476
1476 220
220 764
764 898
898 790
790 1868
1868 90
90 271
271 787
787 294
294 1087
1087 215
215 342
342 636
636 350
350 646
646 1335
13...

output:

1

result:

ok single line: '1'

Test #21:

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

input:

2000 506
1456 192
192 699
699 1473
1473 101
101 1798
1798 1708
1708 1185
1185 1850
1850 961
961 471
471 1866
1866 662
662 562
562 88
88 831
831 601
601 893
893 860
860 1951
1951 362
362 434
434 1879
1879 255
255 304
304 1181
1181 957
957 213
213 1902
1902 173
173 743
743 417
417 48
48 1262
1262 1121...

output:

4

result:

ok single line: '4'

Test #22:

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

input:

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

output:

3

result:

ok single line: '3'

Test #23:

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

input:

2000 961
396 15
15 401
401 1074
1074 1431
1431 775
775 428
428 278
278 1762
1762 402
402 156
156 1303
1303 1897
1897 460
460 212
212 165
165 318
318 1094
1094 1865
1865 977
977 588
588 580
580 41
41 1127
1127 1010
1010 1035
1035 1319
1319 1078
1078 1059
1059 1210
1210 518
518 1077
1077 79
79 556
556...

output:

10

result:

ok single line: '10'

Test #24:

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

input:

2000 999
1747 1211
1211 1085
1085 1457
1457 1761
1761 420
420 565
565 1624
1624 1920
1920 1859
1859 1924
1924 1572
1572 1092
1092 1642
1642 218
218 1728
1728 417
417 603
603 145
145 374
1747 1243
1747 903
1243 658
1243 1180
658 1552
658 245
1552 148
1552 228
148 1498
148 1168
1498 1599
1498 1578
159...

output:

9

result:

ok single line: '9'

Test #25:

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

input:

2000 526
1376 1751
1751 1728
1728 145
1987 145
1987 517
1864 557
1864 517
557 718
112 718
112 1859
1703 1859
1703 1193
726 1193
726 1031
34 443
34 1031
1662 941
1662 1855
379 643
379 1018
769 491
769 643
348 491
348 366
1909 453
1909 366
116 453
116 581
1270 94
1270 581
94 1351
1351 1139
1934 1863
1...

output:

7

result:

ok single line: '7'

Test #26:

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

input:

2000 508
100 1383
1383 82
82 676
1055 676
1055 974
1105 1776
1105 974
1776 571
571 84
1856 84
1856 932
678 1805
678 27
1093 347
1093 354
651 520
651 68
1165 733
1165 68
733 621
1313 1404
1313 1936
1231 766
1231 1297
766 1815
1815 323
323 1434
1628 1434
1628 753
1205 124
1205 1523
272 1516
272 1186
5...

output:

1

result:

ok single line: '1'

Test #27:

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

input:

2000 528
398 366
128 1316
128 320
838 18
838 1755
18 411
537 411
537 740
1869 740
1869 750
1096 750
1096 863
321 597
321 926
877 1892
877 564
1835 1197
1835 186
573 1810
573 1197
1810 25
25 292
675 1730
675 257
624 1218
624 886
1448 1326
1448 1469
1384 410
1384 1469
410 785
785 1555
610 1555
610 548...

output:

7

result:

ok single line: '7'

Test #28:

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

input:

2000 511
997 1974
997 472
1974 900
1974 285
1974 309
900 475
900 1254
900 383
475 1500
475 1948
1500 1080
1080 26
26 1656
1656 213
1656 1978
213 447
213 956
213 1278
447 1175
447 651
447 1797
447 1245
1175 1515
1175 72
1515 1892
1515 957
1515 567
1892 1319
1319 1130
1990 1130
1990 186
1650 64
1650 1...

output:

2

result:

ok single line: '2'

Test #29:

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

input:

2000 520
1361 533
1361 1936
533 984
984 156
1580 156
1580 924
1986 812
1986 924
812 988
988 1309
988 1450
988 1062
1309 1845
1845 1625
1625 297
1625 1970
1625 1711
297 1372
297 333
1372 1546
619 1546
619 1029
24 1029
24 1512
24 1539
627 302
627 965
850 1388
850 1789
1719 1213
1719 1789
1719 1777
172...

output:

5

result:

ok single line: '5'

Test #30:

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

input:

2000 509
1760 737
1760 1465
1760 376
1760 1433
737 1269
737 1204
1269 1106
1269 1326
1269 1081
1106 255
895 255
895 1983
1496 48
1496 1361
1496 186
1518 1959
1518 1361
1959 1585
1585 218
218 1980
1980 568
568 1004
1004 663
1643 1511
1643 663
1643 838
1209 1336
1209 838
278 1336
278 1847
1830 1652
18...

output:

0

result:

ok single line: '0'

Subtask #3:

score: 30
Accepted

Test #31:

score: 30
Accepted
time: 339ms
memory: 42232kb

input:

200000 100000
185785 19011
19011 181550
181550 117972
117972 192238
192238 137685
137685 10126
10126 193657
193657 130856
130856 119980
119980 37122
37122 24497
24497 162102
162102 104298
104298 61332
61332 103789
103789 71060
71060 54044
54044 12075
12075 55296
55296 70106
70106 27512
27512 190160
...

output:

4

result:

ok single line: '4'

Test #32:

score: 0
Accepted
time: 157ms
memory: 41872kb

input:

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

output:

8

result:

ok single line: '8'

Test #33:

score: 0
Accepted
time: 343ms
memory: 40672kb

input:

200000 100000
16998 125645
125645 171820
171820 114276
114276 56649
56649 79575
79575 12368
12368 165362
165362 121507
121507 97604
97604 95803
95803 166064
166064 34692
34692 79122
79122 196245
196245 118382
118382 23706
23706 5613
5613 79967
79967 189807
189807 22420
22420 91378
91378 163988
16398...

output:

6

result:

ok single line: '6'

Test #34:

score: 0
Accepted
time: 146ms
memory: 41068kb

input:

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

output:

2

result:

ok single line: '2'

Test #35:

score: 0
Accepted
time: 338ms
memory: 37160kb

input:

200000 92212
154665 186755
186755 34426
34426 62560
62560 102764
102764 146653
146653 10601
10601 57489
57489 175122
175122 106567
106567 17032
17032 143043
143043 144788
144788 80662
80662 23840
23840 22198
22198 187257
187257 102646
102646 119845
119845 1996
1996 166213
166213 164599
164599 198625...

output:

8

result:

ok single line: '8'

Test #36:

score: 0
Accepted
time: 154ms
memory: 40872kb

input:

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

output:

10

result:

ok single line: '10'

Test #37:

score: 0
Accepted
time: 325ms
memory: 37536kb

input:

200000 85796
134991 80269
80269 173185
173185 27752
27752 29879
29879 39943
39943 89030
89030 19246
19246 189377
189377 32595
32595 25167
25167 124720
124720 111123
111123 92985
92985 93436
93436 127124
127124 67035
67035 156339
156339 29358
29358 92195
92195 103104
103104 72646
72646 124927
124927 ...

output:

9

result:

ok single line: '9'

Test #38:

score: 0
Accepted
time: 154ms
memory: 40168kb

input:

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

output:

7

result:

ok single line: '7'

Test #39:

score: 0
Accepted
time: 422ms
memory: 34552kb

input:

200000 50013
170581 23186
23186 177134
163331 177134
163331 132181
194751 35470
194751 132181
35470 65283
28070 65283
28070 781
180242 143138
180242 143600
48463 148936
48463 100936
148936 96574
96574 78505
78505 63572
194815 63572
194815 48573
152482 167917
152482 48573
167917 87036
87036 85202
160...

output:

2

result:

ok single line: '2'

Test #40:

score: 0
Accepted
time: 432ms
memory: 32512kb

input:

200000 50009
53254 34021
125082 34021
125082 101474
183290 70640
183290 60628
118612 135923
118612 101741
151744 188168
151744 106117
187249 99079
187249 28295
161668 143405
161668 178611
143405 186756
186756 432
432 174138
174138 18523
89734 116022
89734 62141
18384 58216
18384 14826
58216 38113
38...

output:

0

result:

ok single line: '0'

Test #41:

score: 0
Accepted
time: 424ms
memory: 34820kb

input:

200000 50013
88111 107134
54853 107134
54853 107827
40532 78310
40532 107827
78310 153257
182406 163365
182406 192796
34868 77975
34868 53279
77975 62729
15477 62729
15477 152283
130336 152283
130336 175136
196175 175136
196175 32916
111036 168236
111036 138509
14793 32143
14793 149750
99955 149750
...

output:

2

result:

ok single line: '2'

Test #42:

score: 0
Accepted
time: 421ms
memory: 39144kb

input:

200000 50016
191219 46655
79886 46655
79886 132683
126512 21011
126512 132683
21011 79636
132650 45498
132650 196169
180748 170342
180748 179651
53230 179651
53230 193295
113881 193295
113881 187037
122368 89628
122368 39922
1483 36046
1483 89628
36046 124372
124372 14058
91758 14058
91758 130182
36...

output:

3

result:

ok single line: '3'

Test #43:

score: 0
Accepted
time: 414ms
memory: 31788kb

input:

200000 50018
154589 9697
76973 4356
76973 162487
94252 51141
94252 127195
107784 72724
107784 144011
42535 10544
42535 144011
100980 17309
100980 145916
78361 131057
78361 3275
138599 3275
138599 79138
38607 171999
38607 79138
171999 150076
150076 34712
152426 34712
152426 61160
166671 2276
166671 3...

output:

3

result:

ok single line: '3'

Test #44:

score: 0
Accepted
time: 411ms
memory: 37956kb

input:

200000 50014
47360 128036
128036 191338
191338 157765
157765 141561
57871 141561
57871 58778
138682 139852
138682 6448
147905 15680
147905 6448
15680 137305
137305 194588
194588 6409
6409 131353
131353 179360
179360 54860
54860 111448
123782 111448
123782 76593
188181 2537
188181 76593
2537 46075
62...

output:

3

result:

ok single line: '3'

Test #45:

score: 0
Accepted
time: 441ms
memory: 39164kb

input:

200000 50029
164841 183189
183189 155845
155845 141581
141581 24144
24144 170222
170222 129184
95002 129184
95002 135901
41224 29736
41224 135901
158337 29736
158337 99202
140435 99202
140435 198953
49064 157415
49064 151463
123429 84281
123429 141037
84281 46503
46503 9523
9523 122954
122954 61136
...

output:

8

result:

ok single line: '8'

Test #46:

score: 0
Accepted
time: 457ms
memory: 32612kb

input:

200000 50015
94558 13078
120450 13078
120450 58559
113171 58559
113171 115752
58951 115752
58951 130988
59217 56758
59217 130988
175441 56758
175441 101975
181623 16394
181623 20434
35410 40765
35410 143333
61929 40765
61929 173496
133807 43920
133807 173496
43920 1520
1520 51520
79530 107878
79530 ...

output:

2

result:

ok single line: '2'

Test #47:

score: 0
Accepted
time: 462ms
memory: 33984kb

input:

200000 50019
100976 21386
54405 21386
54405 106988
187496 165594
187496 198768
108910 4552
108910 169830
153197 44334
153197 141781
11091 167119
11091 44334
167119 133936
133936 117111
117111 17706
13050 17706
13050 37494
173717 40923
173717 37494
40923 61691
179943 135508
179943 33828
48814 40443
4...

output:

4

result:

ok single line: '4'

Test #48:

score: 0
Accepted
time: 450ms
memory: 34508kb

input:

200000 50015
41218 36746
36746 61530
182706 61530
182706 11941
49603 11941
49603 144834
8207 144834
8207 167684
5403 26230
5403 32778
54058 104163
54058 32778
95753 104163
95753 171272
39726 3635
39726 141985
26531 17601
26531 110064
192916 41569
192916 17601
41569 78920
78920 144967
144967 133941
1...

output:

2

result:

ok single line: '2'

Test #49:

score: 0
Accepted
time: 450ms
memory: 37796kb

input:

200000 50032
32139 110705
136340 88294
136340 43597
198825 29886
198825 163916
197709 186561
197709 50762
165557 61591
165557 122505
165839 122505
165839 162251
2427 78007
2427 181894
79339 38177
79339 48295
171133 364
171133 56124
125448 77502
125448 364
77502 159484
156307 159484
156307 83400
1289...

output:

9

result:

ok single line: '9'

Test #50:

score: 0
Accepted
time: 431ms
memory: 39120kb

input:

200000 50008
192794 76389
6492 76389
6492 110252
26774 145638
26774 110252
145638 31685
31685 101692
101692 103033
75760 103033
75760 188802
80328 107656
80328 182799
21451 166787
21451 107656
166787 182607
182607 61306
61306 107984
82116 107984
82116 18031
30598 90659
30598 18031
90659 47780
103629...

output:

1

result:

ok single line: '1'

Test #51:

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

input:

1 1
1

output:

0

result:

ok single line: '0'

Subtask #4:

score: 59
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #52:

score: 59
Accepted
time: 218ms
memory: 22640kb

input:

200000 18000
6434 18467
56964 19777
14839 123665
66357 19563
196834 70526
82812 63847
119244 173742
84904 150987
76507 2333
16021 7428
185021 42166
150224 67924
14462 96030
135013 128663
55651 125107
93822 188702
72756 45323
35221 140933
78371 32421
30611 15301
62249 101046
26303 49446
196385 1043
1...

output:

17943

result:

ok single line: '17943'

Test #53:

score: 0
Accepted
time: 225ms
memory: 24084kb

input:

200000 18000
244 8144
15173 50113
108957 163694
18829 69076
89997 731
102928 129868
185639 61960
50545 64932
9711 6813
49137 68081
9069 90633
68564 43698
23132 47225
81064 71601
150508 16151
102188 77993
72431 19160
27574 932
155749 50142
13421 32037
17073 338
18821 783
3427 99254
12277 133816
45898...

output:

17948

result:

ok single line: '17948'

Test #54:

score: 0
Accepted
time: 216ms
memory: 22332kb

input:

200000 18000
65666 83232
30077 22734
40619 82166
19419 5885
1144 60159
65009 63258
86444 88085
88524 47887
22035 26804
170979 49470
48187 116828
3662 8285
1661 11751
105427 142235
6064 11147
78094 41237
93758 32097
22679 3587
162238 136717
2534 3370
74906 154360
135117 6309
165106 48487
128742 68568...

output:

0

result:

ok single line: '0'

Test #55:

score: 0
Accepted
time: 231ms
memory: 22508kb

input:

200000 18000
31285 23634
29114 68464
18786 77132
18665 4374
88185 97186
90219 18202
86818 32466
50050 44637
95207 23601
37299 5173
53435 92147
10275 8631
160306 31626
149379 174405
129766 120782
6945 5018
5376 4352
91150 3746
15458 28416
46339 153860
199783 85266
109119 177071
5263 2399
83941 78122
...

output:

17939

result:

ok single line: '17939'

Test #56:

score: 0
Accepted
time: 227ms
memory: 22548kb

input:

200000 18000
198664 38019
14742 179753
111549 90600
7197 18137
25332 26476
195574 81763
146935 177755
81403 167965
125572 117496
164511 114880
4036 13441
91068 79037
119152 10872
148599 143028
24758 149730
141937 120076
53460 72808
48008 12127
87905 104953
47605 49807
84784 88703
16386 9185
2567 627...

output:

0

result:

ok single line: '0'

Test #57:

score: 0
Accepted
time: 231ms
memory: 22964kb

input:

200000 18000
83604 5858
136235 17737
162866 4352
79124 71811
195235 133891
84834 26868
156330 70545
74519 105234
94837 120681
148375 100724
13237 12843
135282 71543
39667 3846
22581 18121
125591 12589
77769 44774
146330 1110
73784 68322
42938 27258
7854 777
160428 160689
7534 2186
73417 161817
18955...

output:

0

result:

ok single line: '0'

Test #58:

score: 0
Accepted
time: 254ms
memory: 27428kb

input:

200000 75004
17387 54854
54854 109619
109619 190572
190572 188608
188608 36800
36800 163130
163130 130576
17387 44073
17387 118256
118256 69713
118256 18705
18705 98391
18705 51984
51984 19903
51984 9650
9650 150508
9650 44636
44636 24559
44636 192059
192059 121208
192059 107609
107609 75808
107609 ...

output:

2

result:

ok single line: '2'

Test #59:

score: 0
Accepted
time: 240ms
memory: 27300kb

input:

200000 75004
154909 45313
45313 105630
105630 184284
184284 135763
135763 127450
154909 183398
154909 30398
30398 144376
30398 88355
88355 168192
88355 18397
18397 176140
18397 53291
53291 166929
53291 25116
25116 106309
25116 81340
81340 106307
81340 17963
17963 15565
17963 31592
31592 61980
31592 ...

output:

2

result:

ok single line: '2'

Test #60:

score: 0
Accepted
time: 273ms
memory: 26560kb

input:

200000 87512
104678 73357
73357 187085
187085 169183
169183 106847
106847 152761
152761 119676
119676 155998
155998 97062
97062 147241
147241 127862
127862 138653
138653 26919
26919 174384
174384 163747
163747 68816
68816 33219
33219 171000
171000 102710
102710 41985
104678 193522
104678 172339
1723...

output:

9

result:

ok single line: '9'

Test #61:

score: 0
Accepted
time: 299ms
memory: 26804kb

input:

200000 87506
154591 93945
93945 41788
41788 113962
113962 39619
39619 186647
186647 49327
49327 63117
154591 136282
154591 112625
112625 36549
112625 33351
33351 30582
33351 103677
103677 72983
103677 177165
177165 136278
177165 86019
86019 197108
86019 190948
190948 138403
190948 198657
198657 1683...

output:

3

result:

ok single line: '3'

Test #62:

score: 0
Accepted
time: 153ms
memory: 41160kb

input:

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

output:

9

result:

ok single line: '9'

Test #63:

score: 0
Accepted
time: 156ms
memory: 41728kb

input:

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

output:

7

result:

ok single line: '7'

Test #64:

score: 0
Accepted
time: 147ms
memory: 40620kb

input:

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

output:

7

result:

ok single line: '7'

Test #65:

score: 0
Accepted
time: 170ms
memory: 40904kb

input:

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

output:

10

result:

ok single line: '10'

Test #66:

score: 0
Accepted
time: 212ms
memory: 31436kb

input:

200000 50011
131962 166813
166813 127665
127665 137347
137347 67044
67044 169175
169175 143703
143703 194179
194179 60157
60157 60312
60312 82622
82622 38366
38366 198420
198420 115693
115693 60613
60613 103220
103220 112750
112750 99011
99011 43881
43881 29549
29549 85467
85467 36990
36990 17699
17...

output:

9

result:

ok single line: '9'

Test #67:

score: 0
Accepted
time: 255ms
memory: 31556kb

input:

200000 50002
172442 174907
174907 107604
107604 20796
20796 3580
3580 140561
140561 97321
97321 179590
179590 50305
50305 198431
198431 182681
182681 31820
31820 48516
48516 41760
41760 69278
69278 159976
159976 160714
160714 60722
60722 54574
54574 172131
172131 14104
14104 4644
4644 137326
137326 ...

output:

0

result:

ok single line: '0'

Test #68:

score: 0
Accepted
time: 205ms
memory: 31352kb

input:

200000 50006
155510 11224
11224 173739
173739 1618
1618 48164
48164 46737
46737 107599
107599 83596
83596 39785
39785 180992
180992 179904
179904 150916
150916 120617
120617 86650
86650 197624
197624 164650
164650 189403
189403 93027
93027 3051
3051 128911
128911 116322
116322 52062
52062 24281
2428...

output:

4

result:

ok single line: '4'

Test #69:

score: 0
Accepted
time: 214ms
memory: 31504kb

input:

200000 50005
148869 65305
65305 21024
21024 192741
192741 165469
165469 168379
168379 130554
130554 115931
115931 131938
131938 96749
96749 175124
175124 29394
29394 188106
188106 90830
90830 36405
36405 180428
180428 81818
81818 13616
13616 197676
197676 196014
196014 71628
71628 177241
177241 1828...

output:

3

result:

ok single line: '3'

Test #70:

score: 0
Accepted
time: 208ms
memory: 31628kb

input:

200000 50002
54510 170158
170158 39517
39517 137544
137544 88028
88028 62705
62705 21635
21635 154902
154902 168428
168428 198242
198242 59837
59837 196784
196784 73358
73358 139157
139157 181952
181952 119694
119694 166480
166480 178134
178134 31885
31885 65233
65233 80331
80331 73862
73862 98024
9...

output:

0

result:

ok single line: '0'

Test #71:

score: 0
Accepted
time: 214ms
memory: 31432kb

input:

200000 50004
62305 62808
62808 184706
184706 74679
74679 24196
24196 2239
2239 133429
133429 37052
37052 121309
121309 64427
64427 107465
107465 31603
31603 224
224 104485
104485 185199
185199 108194
108194 107741
107741 119749
119749 84094
84094 100826
100826 1605
1605 55531
55531 140090
140090 187...

output:

2

result:

ok single line: '2'

Test #72:

score: 0
Accepted
time: 214ms
memory: 31628kb

input:

200000 50006
76961 117752
117752 50874
50874 71701
71701 83427
83427 173831
173831 106954
106954 155192
155192 183861
183861 122533
122533 42527
42527 183998
183998 131860
131860 135230
135230 11813
11813 180194
180194 157566
157566 12493
12493 198747
198747 164266
164266 195795
195795 78432
78432 9...

output:

4

result:

ok single line: '4'

Test #73:

score: 0
Accepted
time: 224ms
memory: 30544kb

input:

200000 50002
179054 109043
109043 179476
179476 11001
11001 187773
187773 119146
119146 145719
145719 125112
125112 172031
172031 108863
108863 63157
63157 20231
20231 153069
153069 26965
26965 7047
7047 134613
134613 98226
98226 164592
164592 69922
69922 124521
124521 183905
183905 163098
163098 12...

output:

0

result:

ok single line: '0'

Test #74:

score: 0
Accepted
time: 206ms
memory: 31628kb

input:

200000 50011
130990 86009
86009 22509
22509 69966
69966 16843
16843 136967
136967 171941
171941 94765
94765 196865
196865 26935
26935 73158
73158 178185
178185 19936
19936 78603
78603 9226
9226 161072
161072 169309
169309 178418
178418 123031
123031 90297
90297 197882
197882 91237
91237 92768
92768 ...

output:

9

result:

ok single line: '9'

Test #75:

score: 0
Accepted
time: 208ms
memory: 31504kb

input:

200000 50007
186939 134875
134875 43572
43572 156089
156089 14422
14422 13795
13795 185528
185528 114869
114869 60328
60328 27536
27536 131445
131445 90852
90852 160530
160530 172996
172996 197132
197132 57730
57730 182829
182829 188203
188203 157601
157601 117852
117852 187888
187888 162759
162759 ...

output:

5

result:

ok single line: '5'

Test #76:

score: 0
Accepted
time: 259ms
memory: 31024kb

input:

200000 99999
106661 121492
121492 148319
148319 74753
74753 173944
173944 110771
110771 149337
149337 37166
106661 139654
106661 40112
139654 38893
139654 180693
38893 81651
38893 97411
81651 18015
81651 106260
18015 8682
18015 118742
8682 84132
8682 16087
84132 135240
84132 167408
135240 35387
1352...

output:

3

result:

ok single line: '3'

Test #77:

score: 0
Accepted
time: 246ms
memory: 29200kb

input:

200000 99999
9532 12689
12689 11808
11808 70411
70411 159372
159372 197606
197606 126028
126028 11436
11436 104870
104870 111819
111819 52200
52200 68142
68142 22129
22129 107278
107278 111559
111559 156968
156968 178570
178570 72594
72594 30761
30761 45131
9532 151089
9532 112873
151089 138200
1510...

output:

9

result:

ok single line: '9'

Test #78:

score: 0
Accepted
time: 424ms
memory: 33056kb

input:

200000 50026
57791 107469
177738 152929
177738 69039
23980 96819
23980 13386
1939 13386
1939 196210
44242 196210
44242 139133
52854 188852
52854 139133
188852 87496
87496 29159
8750 29159
8750 144421
33017 144421
33017 187022
45628 187022
45628 150900
33806 184720
33806 87851
10262 175465
10262 8785...

output:

7

result:

ok single line: '7'

Test #79:

score: 0
Accepted
time: 386ms
memory: 31360kb

input:

200000 50018
7640 85846
85846 86985
86985 45163
45163 6672
6672 105817
32946 105817
32946 54455
26412 114730
26412 190752
139370 188485
139370 114730
172111 171593
172111 185922
138945 111419
138945 25933
108235 42486
108235 103800
48781 190416
48781 103800
190416 127181
71265 37362
71265 29180
1194...

output:

3

result:

ok single line: '3'

Test #80:

score: 0
Accepted
time: 420ms
memory: 38520kb

input:

200000 50008
19710 181788
181788 133596
133596 34673
131675 34673
131675 198198
149777 119958
149777 198198
11492 119958
11492 186283
138293 139264
138293 186283
198120 139264
198120 40330
106384 132516
106384 137776
116766 96549
116766 137776
96549 20254
20254 81823
81823 152129
152129 183598
12537...

output:

1

result:

ok single line: '1'

Test #81:

score: 0
Accepted
time: 388ms
memory: 34892kb

input:

200000 50013
34125 9882
26030 9882
26030 197236
192985 102363
192985 197236
189582 102363
189582 161237
14986 47229
14986 161237
47229 50804
50804 197449
118749 197449
118749 18546
21511 164182
21511 15373
111558 147863
111558 53165
38816 112176
38816 170721
112176 102574
67538 102574
67538 107007
1...

output:

2

result:

ok single line: '2'

Test #82:

score: 0
Accepted
time: 418ms
memory: 36688kb

input:

200000 50021
41496 56092
56092 59287
162038 59287
162038 180254
95107 87572
95107 180254
87572 140400
140400 66253
66253 96454
96454 53458
53458 42885
42885 106156
106156 74637
191277 74637
191277 185591
114090 32953
114090 103424
198328 198700
198328 32953
30749 198700
30749 1087
108409 141481
1084...

output:

4

result:

ok single line: '4'

Test #83:

score: 0
Accepted
time: 404ms
memory: 31676kb

input:

200000 50015
106332 15179
63102 15179
63102 70904
35801 77739
35801 6681
70189 25841
70189 151262
141983 153866
141983 31508
96477 128276
96477 186484
2212 50487
2212 62502
10861 62502
10861 89493
124006 89493
124006 82001
65137 161077
65137 82001
161077 189866
189866 199519
190369 199519
190369 134...

output:

2

result:

ok single line: '2'

Test #84:

score: 0
Accepted
time: 436ms
memory: 37464kb

input:

200000 50033
185981 53069
141148 53069
141148 82033
57629 148695
57629 6958
80665 132780
80665 45270
99309 45270
99309 66531
177972 83187
177972 66531
83187 37351
56468 37351
56468 42693
76577 48653
76577 42693
48653 193171
193171 7618
102381 7618
102381 11576
11773 176865
11773 11576
176865 90597
9...

output:

8

result:

ok single line: '8'

Test #85:

score: 0
Accepted
time: 401ms
memory: 35836kb

input:

200000 50015
80287 46049
46049 146235
146235 121220
121220 47957
47957 116600
70331 116600
70331 92871
469 84780
469 138058
169402 5872
169402 67101
59500 515
59500 120287
43222 84729
43222 172408
84729 180048
180048 181734
181734 121187
121187 178600
178600 170946
170946 69333
69333 60092
66568 600...

output:

2

result:

ok single line: '2'

Test #86:

score: 0
Accepted
time: 413ms
memory: 31140kb

input:

200000 50019
74878 176858
176858 170244
170244 22888
22888 121510
121510 80717
80717 162320
1962 162320
1962 69103
75761 110356
75761 69103
74614 60297
74614 86692
164496 88401
164496 60185
3362 178235
3362 88401
178235 142715
16964 142715
16964 168663
96081 176322
96081 168663
176322 104559
198570 ...

output:

4

result:

ok single line: '4'

Test #87:

score: 0
Accepted
time: 410ms
memory: 32984kb

input:

200000 50014
176882 197303
36140 197303
36140 50319
171792 50319
171792 129341
123940 116038
123940 194284
144445 27275
144445 181609
41194 181609
41194 62934
33160 4429
33160 183000
189809 195831
189809 11936
195831 79337
57090 113442
57090 61929
118974 157348
118974 67462
73724 119054
73724 67462
...

output:

3

result:

ok single line: '3'

Test #88:

score: 0
Accepted
time: 359ms
memory: 35780kb

input:

200000 50032
110121 50450
110121 121667
110121 49736
50450 126606
126606 93030
88071 93030
88071 156902
88071 161731
88071 77501
185928 158025
185928 189614
185928 156902
158025 82236
165406 82236
165406 26508
32146 41631
32146 26508
41631 46701
46701 109016
46701 194202
109016 134572
142469 134572
...

output:

9

result:

ok single line: '9'

Test #89:

score: 0
Accepted
time: 368ms
memory: 30168kb

input:

200000 50011
126568 86258
86258 54731
14587 199780
14587 171890
14587 89278
14587 198694
62334 143158
62334 165817
143158 146738
143158 123588
143158 164812
146738 122309
122309 114685
122309 157449
122309 76635
114685 38689
16171 38689
16171 170051
149157 3141
149157 170051
3141 107442
3141 10349
1...

output:

2

result:

ok single line: '2'

Test #90:

score: 0
Accepted
time: 347ms
memory: 29844kb

input:

200000 50005
179379 68532
68532 1431
68532 29828
68532 133114
1431 149770
149770 42387
149770 134778
149770 170863
172018 42387
172018 20322
172018 105767
15305 160474
15305 20322
160474 97256
97256 32727
97256 24419
32727 136706
161140 143789
161140 136706
161140 15467
42513 73330
42513 15467
42513...

output:

0

result:

ok single line: '0'

Test #91:

score: 0
Accepted
time: 359ms
memory: 34156kb

input:

200000 50008
145488 56008
56008 28802
28802 163358
163358 22589
163358 45610
163358 176826
163358 181429
163358 55151
22589 163897
163897 172740
101177 172740
101177 180856
86341 199039
86341 199919
86341 139924
86341 180856
199039 109049
109049 162323
162323 145424
145424 87873
145424 160803
145424...

output:

1

result:

ok single line: '1'

Test #92:

score: 0
Accepted
time: 342ms
memory: 30764kb

input:

200000 50030
16548 40593
40593 141945
141945 100670
141945 94492
29735 166306
29735 94492
29735 144891
149797 96430
149797 144891
96430 110493
110493 147199
147199 52885
147199 44864
147199 62285
52885 4725
52885 66844
4725 173593
173593 9750
9750 172644
172644 22322
172644 36711
172644 134835
22322...

output:

7

result:

ok single line: '7'

Test #93:

score: 0
Accepted
time: 359ms
memory: 31060kb

input:

200000 50011
144146 162968
162968 63877
63877 84650
84650 178936
172494 58354
172494 53508
172494 87783
172494 191599
44769 18736
44769 6888
44769 129455
18736 185785
185785 126664
126664 167379
167379 18112
18112 110696
18112 21984
179330 21984
179330 180414
178882 135936
178882 180414
178882 16159...

output:

2

result:

ok single line: '2'

Test #94:

score: 0
Accepted
time: 351ms
memory: 29964kb

input:

200000 50011
85804 11690
194897 11690
194897 90490
177978 170987
177978 90490
170987 185051
170987 52045
170987 70504
185051 48499
23456 166612
23456 112584
23456 44963
23456 98842
23456 48499
23456 67671
163636 112565
163636 68434
38391 68434
38391 196187
1869 146703
1869 196187
1869 141315
64400 2...

output:

2

result:

ok single line: '2'

Test #95:

score: 0
Accepted
time: 354ms
memory: 32980kb

input:

200000 50011
198879 63743
63743 111637
63743 72658
63743 49604
111637 32997
32997 115498
115498 96932
96932 145532
96932 44638
145532 165943
145582 165943
145582 79172
105580 21942
105580 79172
21942 186321
10188 186321
10188 173839
156670 133443
156670 96285
156670 149023
34699 110604
34699 149023
...

output:

2

result:

ok single line: '2'

Test #96:

score: 0
Accepted
time: 356ms
memory: 31412kb

input:

200000 50033
128774 82416
47043 82416
47043 47399
47043 189938
124551 180084
124551 196278
124551 38772
124551 168821
75740 91794
75740 38772
75740 5561
91794 25990
27580 25990
27580 124014
168717 96102
168717 184371
168717 124014
168717 168517
122114 168517
122114 196113
130699 89737
130699 196113
...

output:

8

result:

ok single line: '8'

Test #97:

score: 0
Accepted
time: 378ms
memory: 33672kb

input:

200000 50012
52343 144639
156032 144639
156032 90717
156032 5303
156032 73496
53328 124290
53328 176043
69844 59954
69844 176043
59954 141859
141859 142003
142003 52291
142003 183620
142003 185568
142003 149596
12676 149596
12676 119796
195606 135450
195606 89440
5625 129963
5625 147559
138410 71770...

output:

1

result:

ok single line: '1'

Extra Test:

score: 0
Extra Test Passed