QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#292926#7603. Mex on DAGship2077AC ✓634ms29080kbC++141.6kb2023-12-28 16:57:112023-12-28 16:57:11

Judging History

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

  • [2023-12-28 16:57:11]
  • 评测
  • 测评结果:AC
  • 用时:634ms
  • 内存:29080kb
  • [2023-12-28 16:57:11]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int N=2005,M=8005;
queue<int>q;vector<int>g[M],e[M];
int n,l,r,tp,ans,num,idx,Index;bitset<N>bit[N];
int x[M],y[M],deg[M],scc[M],stk[M],low[M],dfn[M],head[M];
int read(){
	int x=0;char ch=getchar();
	while (!isdigit(ch)) ch=getchar();
	while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
	return x;
}
void Tarjan(int x){
	stk[++tp]=x;low[x]=dfn[x]=++idx;
	for (auto y:g[x]){
		if (!dfn[y]) Tarjan(y),low[x]=min(low[x],low[y]);
		if (!scc[y]) low[x]=min(low[x],dfn[y]);
	}
	if (low[x]!=dfn[x]) return ;
	scc[x]=++Index;while (stk[tp]!=x)
		scc[stk[tp--]]=Index; tp--;
}
bool check(int mid){ num=idx=Index=0; int n=mid<<1;
	for (int i=0;i<n<<1;i++) head[i]=scc[i]=low[i]=dfn[i]=0,vector<int>().swap(g[i]);
	for (int i=0;i<n;i++)
		for (int j=i+1;j<n;j++)
			if (!bit[y[i]][x[j]]&&!bit[y[j]][x[i]])
				g[i].push_back(j+n),g[j].push_back(i+n);
	for (int i=0;i<n;i+=2)
		g[i+n].push_back(i+1),g[i+1+n].push_back(i);
	for (int i=0;i<n<<1;i++)
		if (!dfn[i]) Tarjan(i);
	for (int i=0;i<n;i++)
		if (scc[i]==scc[i+n])
			return 0;
	return 1;
}
int main(){
	n=read();
	for (int i=0;i<n<<1;i++)
		x[i]=read()-1,y[i]=read()-1,
		deg[x[i]]++,e[y[i]].push_back(x[i]);
	for (int i=0;i<n;i++) bit[i].set(i);
	for (int i=0;i<n;i++)
		if (!deg[i]) q.push(i);
	while (!q.empty()){
		int x=q.front();q.pop();
		for (auto y:e[x]){
			bit[y]|=bit[x];
			if (!--deg[y]) q.push(y);
		}
	}
	l=1;r=n;ans=0;
	while (l<=r){
		int mid=l+r>>1;
		if (check(mid)) ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

8
3 6
2 7
1 3
2 3
6 7
7 8
7 8
4 6
2 7
1 5
2 5
2 8
6 8
7 8
3 5
7 8

output:

4

result:

ok 1 number(s): "4"

Test #2:

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

input:

15
7 15
10 12
13 14
6 8
14 15
9 10
6 13
1 8
6 8
8 9
14 15
13 14
9 13
7 13
14 15
12 14
6 7
3 14
11 14
3 10
10 12
3 8
8 14
13 14
9 11
10 13
6 10
5 10
1 11
13 14

output:

3

result:

ok 1 number(s): "3"

Test #3:

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

input:

2
1 2
1 2
1 2
1 2

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

3
1 2
1 2
2 3
1 3
2 3
1 3

output:

2

result:

ok 1 number(s): "2"

Test #5:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #6:

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

input:

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

output:

2

result:

ok 1 number(s): "2"

Test #7:

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

input:

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

output:

2

result:

ok 1 number(s): "2"

Test #8:

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

input:

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

output:

1

result:

ok 1 number(s): "1"

Test #9:

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

input:

9
3 6
5 8
7 9
6 8
3 8
8 9
5 9
2 6
6 7
1 7
5 8
2 9
2 7
3 5
4 6
2 8
4 6
4 9

output:

3

result:

ok 1 number(s): "3"

Test #10:

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

input:

10
8 10
9 10
9 10
8 9
9 10
8 9
8 9
4 9
6 7
2 3
8 10
7 9
2 10
3 6
2 10
1 10
7 9
9 10
3 7
4 8

output:

2

result:

ok 1 number(s): "2"

Test #11:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #12:

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

input:

30
16 22
23 29
25 27
15 20
12 28
6 24
9 26
11 18
18 22
12 20
4 11
13 17
22 26
29 30
25 30
7 14
22 28
15 24
23 30
20 26
8 29
15 28
16 30
29 30
8 23
8 30
2 4
1 24
28 29
23 26
12 26
3 5
6 17
22 26
5 16
12 21
1 27
25 29
2 28
11 16
24 28
20 29
29 30
14 29
20 24
16 26
9 10
20 21
5 22
1 29
3 8
3 15
8 9
19 ...

output:

1

result:

ok 1 number(s): "1"

Test #13:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #14:

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

input:

50
26 47
39 47
3 8
36 50
23 24
40 46
48 49
41 49
47 48
34 42
24 25
28 43
15 42
24 32
36 47
20 46
36 50
2 21
48 49
49 50
44 46
49 50
26 28
45 46
23 36
33 40
41 49
42 49
48 50
20 38
6 26
9 43
2 31
10 42
43 45
13 18
42 46
41 46
18 36
7 21
26 47
25 27
3 7
7 47
41 49
37 43
33 48
43 46
17 18
30 41
15 49
5...

output:

1

result:

ok 1 number(s): "1"

Test #15:

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

input:

60
57 60
45 54
45 55
27 46
7 41
42 50
11 12
9 26
6 23
38 48
54 58
32 44
39 56
48 54
30 58
23 46
46 47
56 58
19 33
28 58
37 48
25 60
45 52
35 37
34 54
44 53
7 30
5 51
33 43
7 53
34 49
36 43
31 41
1 53
34 51
44 48
31 38
33 56
40 60
2 56
45 55
12 14
38 44
1 13
50 57
53 58
34 38
12 53
17 38
42 54
11 54
...

output:

2

result:

ok 1 number(s): "2"

Test #16:

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

input:

70
23 52
40 44
48 50
21 29
59 64
6 9
26 37
16 69
9 33
11 27
2 28
48 56
42 49
46 65
1 11
52 55
63 64
5 23
2 51
38 59
33 34
36 50
43 54
23 66
53 54
58 70
58 66
59 69
62 67
55 62
24 47
65 69
66 69
31 59
40 47
33 67
36 63
59 70
7 69
50 53
41 45
50 57
1 69
23 38
42 49
12 34
38 39
58 61
17 26
68 70
14 60
...

output:

1

result:

ok 1 number(s): "1"

Test #17:

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

input:

80
35 58
46 60
11 21
66 70
73 74
24 47
60 77
22 28
23 72
17 38
33 48
21 52
64 77
63 76
72 77
59 60
71 76
10 28
12 17
27 66
24 40
16 60
38 77
23 68
10 59
64 78
30 71
75 76
62 65
33 40
62 78
12 61
24 35
66 78
22 30
21 53
9 46
77 79
77 80
5 9
47 61
11 22
57 63
11 70
3 43
26 59
73 74
62 67
47 63
62 70
5...

output:

1

result:

ok 1 number(s): "1"

Test #18:

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

input:

90
48 64
85 88
10 13
76 77
74 78
89 90
33 75
45 71
79 90
39 71
65 71
85 89
13 40
16 38
64 69
40 84
25 73
67 90
10 18
33 62
9 16
88 90
1 62
37 72
64 80
24 39
60 75
76 81
31 64
87 89
16 59
28 31
88 90
36 52
54 61
87 88
54 73
1 90
20 39
31 82
28 58
39 43
25 60
34 59
12 52
73 84
87 89
27 71
13 85
43 57
...

output:

3

result:

ok 1 number(s): "3"

Test #19:

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

input:

100
71 85
64 73
13 55
75 93
22 28
4 92
12 24
34 46
28 77
87 96
71 97
84 85
46 78
54 93
14 98
46 95
29 90
71 89
98 100
57 84
43 89
51 54
92 100
18 25
13 85
53 84
11 15
61 92
12 96
78 81
28 33
5 63
90 95
20 59
61 82
27 38
85 90
91 92
60 99
35 93
8 78
3 4
2 60
13 46
49 75
42 56
95 100
9 98
8 68
30 39
7...

output:

1

result:

ok 1 number(s): "1"

Test #20:

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

input:

200
163 179
37 124
104 139
16 193
53 109
106 116
196 199
115 167
107 169
90 158
46 148
90 176
188 195
53 189
142 144
170 194
48 128
37 140
2 100
101 187
152 158
75 151
145 158
107 111
133 190
62 98
196 200
95 183
19 183
170 194
42 187
104 168
159 175
28 154
8 199
11 28
176 187
85 187
40 52
125 140
9...

output:

1

result:

ok 1 number(s): "1"

Test #21:

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

input:

300
258 275
105 132
153 200
147 243
205 257
295 299
86 94
55 175
264 273
150 151
269 276
68 191
64 160
66 113
187 190
113 159
50 236
117 164
177 207
205 264
152 275
296 298
128 152
29 145
227 291
212 243
279 290
256 289
81 255
31 78
125 225
49 133
231 292
253 255
199 205
81 162
154 285
58 214
136 18...

output:

3

result:

ok 1 number(s): "3"

Test #22:

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

input:

400
109 161
338 370
332 346
167 268
323 373
171 321
365 376
5 179
317 349
227 361
365 381
252 268
282 325
124 202
21 257
199 339
62 63
200 387
390 395
34 328
252 308
2 295
250 301
266 292
140 280
377 392
154 290
108 260
268 273
99 267
119 132
3 76
232 372
148 160
322 366
379 384
192 250
124 232
170 ...

output:

2

result:

ok 1 number(s): "2"

Test #23:

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

input:

500
215 311
75 384
6 19
330 429
304 435
263 500
86 192
346 470
148 254
100 344
491 493
270 355
86 196
136 250
364 421
258 319
90 494
202 482
90 376
242 359
286 493
329 446
154 427
103 393
385 434
11 198
83 270
29 407
382 436
49 111
55 324
427 464
418 499
295 364
383 390
365 383
93 442
375 450
240 24...

output:

1

result:

ok 1 number(s): "1"

Test #24:

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

input:

600
466 494
548 569
530 584
326 395
169 423
517 593
349 409
197 505
229 323
437 528
171 269
380 422
98 578
56 270
506 559
271 441
111 246
130 496
207 367
514 561
298 390
229 600
103 153
283 332
430 507
235 344
464 476
199 358
570 581
250 531
232 441
584 597
588 598
77 537
112 522
585 594
201 350
130...

output:

1

result:

ok 1 number(s): "1"

Test #25:

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

input:

700
289 645
210 439
319 537
434 672
163 478
131 160
115 587
184 453
186 630
644 657
526 541
369 621
308 685
209 457
580 601
355 363
611 681
364 588
93 620
9 569
361 473
348 449
695 697
484 674
357 588
383 601
360 472
147 220
90 556
103 485
515 579
464 700
635 685
45 273
256 367
300 538
26 266
447 69...

output:

1

result:

ok 1 number(s): "1"

Test #26:

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

input:

800
751 776
711 721
541 561
459 540
743 763
250 317
611 650
346 477
224 336
189 370
218 334
593 608
385 416
321 354
327 611
75 790
359 652
403 786
790 799
127 709
311 491
7 112
529 581
489 677
201 527
733 751
393 566
331 334
401 484
141 374
542 599
754 765
81 459
550 777
530 582
666 755
107 334
773 ...

output:

1

result:

ok 1 number(s): "1"

Test #27:

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

input:

900
605 646
202 660
156 594
75 228
568 809
303 563
444 640
623 683
861 889
471 808
134 843
605 807
696 807
813 818
184 281
374 376
884 885
478 639
475 522
899 900
809 849
311 677
687 872
840 894
459 607
4 450
874 892
744 866
742 892
874 895
642 767
132 447
26 784
283 662
722 732
370 788
761 818
206 ...

output:

1

result:

ok 1 number(s): "1"

Test #28:

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

input:

1000
884 961
256 504
896 951
301 377
637 749
584 696
912 978
105 458
78 340
104 122
648 992
769 973
509 610
649 815
46 349
892 983
698 883
820 916
697 808
68 348
772 986
1 508
919 929
284 451
303 365
19 523
636 657
58 764
64 124
425 902
180 842
672 965
840 985
384 645
261 548
691 788
462 545
48 386
...

output:

1

result:

ok 1 number(s): "1"

Test #29:

score: 0
Accepted
time: 34ms
memory: 21596kb

input:

2000
1420 1715
1721 1770
1506 1817
209 1938
566 787
442 779
879 1646
657 1189
1003 1897
887 1190
1879 1897
357 1913
1288 1317
1111 1320
805 1467
482 1016
802 1310
1015 1614
155 1465
1662 1935
126 1426
888 922
1101 1322
1919 1942
1255 1346
552 625
921 1848
61 1636
316 1328
1609 1858
1510 1989
593 625...

output:

1

result:

ok 1 number(s): "1"

Test #30:

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

input:

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

output:

5

result:

ok 1 number(s): "5"

Test #31:

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

input:

100
1 2
1 2
4 6
5 8
5 8
3 4
2 5
4 7
7 8
2 3
7 10
7 9
5 6
10 13
10 11
9 10
6 8
11 13
9 12
12 15
13 14
11 13
13 15
10 12
12 14
10 11
16 19
15 18
14 15
17 18
14 15
19 20
20 23
20 23
18 21
16 18
16 18
16 19
22 25
19 21
22 24
22 24
21 24
20 23
22 23
21 22
24 25
23 26
25 28
27 30
26 27
24 25
28 29
30 33
2...

output:

3

result:

ok 1 number(s): "3"

Test #32:

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

input:

200
3 4
1 3
1 2
4 5
5 7
2 3
4 6
2 4
3 5
4 5
8 9
4 5
8 10
9 11
7 9
8 10
7 8
7 8
10 12
9 11
13 15
11 12
12 13
11 13
15 17
13 14
14 15
15 17
17 19
14 15
16 18
18 20
19 20
16 18
18 20
16 17
21 22
17 18
18 20
19 21
22 23
20 21
21 23
23 24
23 24
23 24
23 24
26 28
27 28
24 26
28 29
28 29
25 27
28 29
27 28
...

output:

4

result:

ok 1 number(s): "4"

Test #33:

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

input:

200
3 5
1 3
3 5
4 7
5 8
5 8
5 7
2 3
8 9
8 9
3 5
6 8
9 11
4 7
8 9
9 12
7 9
12 13
9 10
11 13
9 11
11 12
14 16
15 18
15 17
12 13
13 14
12 13
13 16
17 20
19 20
15 16
18 19
18 21
17 20
21 22
17 18
20 21
18 20
21 23
19 22
23 26
22 24
23 26
20 23
22 25
22 23
23 25
27 28
28 31
26 27
27 29
29 32
24 25
26 28
...

output:

3

result:

ok 1 number(s): "3"

Test #34:

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

input:

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

output:

2

result:

ok 1 number(s): "2"

Test #35:

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

input:

300
4 7
1 4
5 6
4 7
3 5
6 9
5 6
4 6
8 10
6 8
4 6
8 9
6 9
8 9
5 7
5 7
12 14
6 9
12 13
12 14
12 14
11 12
14 15
15 17
15 17
12 14
12 13
12 13
17 18
12 13
13 15
18 21
19 21
14 15
20 22
16 17
21 24
22 24
17 20
23 25
21 23
22 23
21 23
24 27
24 25
20 23
23 26
22 23
26 28
24 27
28 30
23 24
25 28
25 26
26 29...

output:

2

result:

ok 1 number(s): "2"

Test #36:

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

input:

400
2 4
1 2
2 3
3 5
3 5
2 3
2 4
2 4
4 5
4 6
6 7
4 6
5 6
9 11
9 10
7 9
9 11
9 11
8 9
9 11
12 13
12 13
11 13
11 13
15 16
13 14
13 14
16 17
15 16
13 14
17 18
16 17
17 18
18 19
18 20
17 19
19 20
17 19
22 23
21 22
22 24
22 23
23 24
22 24
22 23
25 27
24 25
25 26
24 26
25 27
25 27
26 27
27 29
28 30
28 30
2...

output:

3

result:

ok 1 number(s): "3"

Test #37:

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

input:

400
2 4
2 4
3 4
2 3
4 7
2 4
4 6
6 7
8 9
4 6
9 10
8 9
10 13
10 11
10 13
7 8
12 14
7 8
13 14
12 13
8 10
10 12
14 16
14 17
10 12
16 19
16 19
13 15
16 18
12 14
17 18
16 19
20 21
20 21
19 22
18 20
19 20
17 18
17 19
21 23
18 19
18 19
25 28
24 26
20 23
22 23
26 29
26 28
23 25
27 28
24 25
25 27
26 28
27 29
...

output:

1

result:

ok 1 number(s): "1"

Test #38:

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

input:

500
1 3
3 5
3 5
3 4
3 4
2 4
2 3
6 8
5 7
4 6
4 5
7 9
7 9
8 9
7 9
6 7
8 9
11 12
9 10
9 10
10 12
12 14
12 14
12 13
12 14
12 14
13 14
15 16
13 15
14 16
17 19
16 17
16 17
15 16
20 21
18 19
18 19
21 23
20 22
21 23
21 22
20 21
24 26
20 22
25 27
24 25
22 23
26 27
27 29
26 27
26 27
26 28
27 28
26 27
26 27
26...

output:

2

result:

ok 1 number(s): "2"

Test #39:

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

input:

500
4 7
2 5
1 3
3 5
2 4
2 5
4 6
4 7
8 11
6 8
5 8
9 10
7 10
9 10
10 11
7 9
10 12
9 10
9 11
11 12
10 11
13 16
14 16
10 12
11 13
12 15
12 13
14 16
18 21
14 15
14 16
15 18
17 20
20 23
18 21
17 18
20 23
18 20
23 25
23 25
22 24
23 26
25 27
19 20
25 28
21 24
26 29
26 27
25 27
28 30
26 28
25 26
29 31
25 26
...

output:

1

result:

ok 1 number(s): "1"

Test #40:

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

input:

600
2 4
1 2
4 6
2 4
4 6
1 2
2 3
2 3
4 5
5 6
8 10
4 5
6 7
6 7
9 11
9 11
10 12
10 11
9 10
11 13
11 12
10 11
13 14
11 13
15 16
14 15
12 13
12 14
17 18
17 18
14 15
16 17
19 21
18 20
18 20
17 18
17 19
17 19
21 23
22 23
20 22
23 25
22 23
23 24
25 26
24 26
22 24
26 28
23 24
26 27
28 30
27 28
28 30
28 29
29...

output:

3

result:

ok 1 number(s): "3"

Test #41:

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

input:

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

output:

6

result:

ok 1 number(s): "6"

Test #42:

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

input:

700
2 4
1 3
4 5
1 3
3 4
4 6
2 3
5 6
6 8
5 6
8 10
6 7
7 8
8 10
6 7
10 11
7 9
7 8
11 13
9 10
9 10
13 15
14 16
12 13
13 14
13 15
12 13
14 16
16 17
13 15
17 19
15 17
17 18
19 21
19 20
18 20
21 22
18 19
19 20
18 19
21 22
23 24
21 22
22 23
25 27
25 27
24 26
26 28
24 25
26 27
28 30
27 28
28 30
28 29
27 29
...

output:

6

result:

ok 1 number(s): "6"

Test #43:

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

input:

700
3 4
3 5
1 2
2 4
1 2
3 4
3 6
1 3
8 9
3 5
8 11
8 11
4 7
10 12
5 7
8 9
8 10
11 13
13 14
12 14
10 13
9 10
14 16
9 11
13 14
15 17
12 14
13 14
14 16
16 19
19 20
19 21
20 23
16 18
18 20
21 24
19 22
22 23
22 25
23 25
21 23
19 21
21 22
24 27
25 27
20 22
25 27
26 29
22 25
28 31
24 27
24 27
26 27
28 29
27 ...

output:

1

result:

ok 1 number(s): "1"

Test #44:

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

input:

800
1 2
2 4
1 3
1 2
3 5
4 5
4 6
6 7
5 6
6 8
8 10
5 7
8 10
7 9
9 10
8 9
11 12
8 10
8 10
12 14
10 12
12 14
10 12
14 16
11 13
15 16
12 14
14 15
15 17
16 17
17 18
15 17
17 18
16 17
16 18
18 19
19 20
19 20
20 21
18 20
20 22
22 23
24 26
23 25
23 25
21 22
22 23
22 23
25 27
26 28
24 25
26 28
29 30
28 30
27 ...

output:

5

result:

ok 1 number(s): "5"

Test #45:

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

input:

800
1 4
3 4
3 4
5 7
5 8
5 8
6 8
5 6
2 4
4 7
8 10
3 6
7 8
6 8
5 7
8 10
8 10
12 14
12 14
9 10
12 15
9 10
10 11
14 17
13 14
16 17
16 18
13 14
15 17
13 14
13 16
15 17
18 19
19 22
17 18
15 17
17 19
18 21
18 19
18 20
21 22
18 20
22 25
23 26
23 25
23 24
23 25
25 28
27 29
28 30
29 31
26 28
27 29
25 28
26 28...

output:

1

result:

ok 1 number(s): "1"

Test #46:

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

input:

900
2 3
3 4
2 4
4 6
4 5
1 3
3 5
5 7
7 9
7 9
8 10
7 9
6 8
5 6
6 8
10 12
11 13
8 10
12 13
11 13
13 14
13 14
10 11
13 14
13 14
15 17
12 14
16 17
13 14
17 19
18 20
14 16
16 18
16 17
19 20
17 18
17 19
20 21
22 24
19 20
21 23
20 22
24 25
23 25
25 26
24 26
23 25
23 24
27 29
27 29
25 27
27 28
29 31
28 30
27...

output:

3

result:

ok 1 number(s): "3"

Test #47:

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

input:

900
3 4
4 5
1 2
3 5
1 2
3 5
2 5
4 7
5 6
3 4
3 6
9 11
4 6
8 9
10 13
10 12
9 12
10 12
9 10
12 13
8 9
12 14
11 13
14 16
15 17
15 17
14 17
17 18
17 20
14 16
17 18
14 16
19 21
18 19
20 21
15 18
21 24
19 21
18 21
20 22
24 26
20 21
21 24
21 22
20 22
21 22
21 22
22 25
25 26
24 27
25 28
29 31
24 26
30 32
25 ...

output:

1

result:

ok 1 number(s): "1"

Test #48:

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

input:

1000
3 5
1 3
2 3
4 5
5 6
2 3
6 8
6 7
5 6
6 7
6 7
6 7
5 7
8 9
10 11
8 10
11 12
11 13
12 13
10 11
9 11
9 11
10 11
12 13
12 13
14 16
12 14
14 16
15 16
17 19
16 17
18 19
17 19
17 18
20 21
20 22
18 20
17 19
22 24
21 22
22 24
22 24
22 23
22 23
22 24
25 27
24 25
23 24
25 27
27 29
27 29
28 29
28 29
29 30
28...

output:

4

result:

ok 1 number(s): "4"

Test #49:

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

input:

1000
1 3
3 6
3 6
4 6
5 6
4 5
6 7
6 8
4 5
3 5
4 7
8 9
10 11
6 9
11 13
6 8
7 9
8 9
9 11
13 16
8 11
12 14
12 13
13 15
13 14
14 16
12 15
11 14
13 15
15 18
14 16
17 20
18 21
15 18
20 22
20 21
17 20
17 20
20 22
19 22
23 24
23 25
19 21
23 25
26 27
23 24
21 22
21 22
28 30
23 26
23 25
29 31
26 28
26 28
28 31...

output:

2

result:

ok 1 number(s): "2"

Test #50:

score: 0
Accepted
time: 28ms
memory: 20864kb

input:

2000
1 3
3 4
2 3
3 5
4 5
5 6
4 5
3 5
3 5
3 5
5 7
8 9
7 8
5 6
6 7
10 11
7 8
11 12
9 11
8 10
12 14
13 15
12 13
11 13
11 12
14 16
13 14
15 16
15 16
15 16
15 16
14 16
19 21
17 18
20 21
18 20
19 21
20 21
20 22
22 23
23 25
20 22
24 25
20 22
21 23
21 22
26 27
26 28
24 26
26 28
28 29
25 26
27 29
25 27
28 29...

output:

4

result:

ok 1 number(s): "4"

Test #51:

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

input:

2000
2 3
4 5
1 4
5 7
3 5
2 4
2 3
4 5
3 4
3 6
5 6
6 7
8 9
10 13
7 10
7 8
11 12
11 14
8 9
12 15
9 11
10 11
13 15
14 17
14 16
13 16
11 14
12 14
15 16
12 15
19 22
14 17
20 22
14 16
15 17
20 22
21 24
21 22
20 21
17 19
18 21
19 20
20 21
19 20
24 27
24 26
24 26
27 29
22 25
28 30
24 27
29 31
28 29
29 30
28 ...

output:

3

result:

ok 1 number(s): "3"

Test #52:

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

input:

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

output:

19

result:

ok 1 number(s): "19"

Test #53:

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

input:

200
1 2
2 3
1 2
1 2
3 4
4 5
3 4
5 6
6 7
5 6
5 6
5 6
7 8
6 7
9 10
7 8
10 11
9 10
10 11
11 12
10 11
10 11
13 14
13 14
13 14
13 14
15 16
14 15
15 16
16 17
16 17
16 17
16 17
17 18
17 18
17 18
20 21
20 21
21 22
20 21
22 23
21 22
22 23
22 23
24 25
22 23
25 26
24 25
26 27
24 25
25 26
26 27
27 28
26 27
28 2...

output:

7

result:

ok 1 number(s): "7"

Test #54:

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

input:

300
2 3
2 3
2 3
2 3
4 5
3 4
3 4
4 5
5 6
5 6
6 7
7 8
6 7
7 8
9 10
9 10
10 11
9 10
10 11
9 10
12 13
12 13
12 13
11 12
13 14
14 15
15 16
13 14
14 15
15 16
17 18
17 18
17 18
17 18
18 19
17 18
18 19
18 19
19 20
20 21
20 21
20 21
21 22
22 23
24 25
22 23
23 24
25 26
24 25
26 27
27 28
27 28
27 28
27 28
27 2...

output:

1

result:

ok 1 number(s): "1"

Test #55:

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

input:

400
2 3
1 2
3 4
1 2
2 3
3 4
5 6
3 4
5 6
4 5
6 7
5 6
6 7
6 7
9 10
9 10
8 9
10 11
10 11
9 10
12 13
10 11
13 14
11 12
12 13
13 14
14 15
15 16
15 16
15 16
15 16
15 16
18 19
18 19
18 19
17 18
20 21
18 19
20 21
20 21
21 22
21 22
21 22
23 24
23 24
22 23
24 25
25 26
26 27
26 27
25 26
26 27
26 27
26 27
29 30...

output:

6

result:

ok 1 number(s): "6"

Test #56:

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

input:

500
2 3
1 2
2 3
3 4
4 5
4 5
4 5
4 5
4 5
6 7
6 7
6 7
8 9
7 8
9 10
8 9
8 9
9 10
10 11
10 11
11 12
11 12
12 13
12 13
14 15
12 13
13 14
14 15
14 15
14 15
16 17
15 16
18 19
18 19
19 20
17 18
18 19
18 19
20 21
19 20
22 23
20 21
21 22
21 22
23 24
22 23
23 24
23 24
26 27
26 27
27 28
27 28
28 29
27 28
28 29
...

output:

3

result:

ok 1 number(s): "3"

Test #57:

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

input:

600
2 3
1 2
3 4
2 3
2 3
3 4
3 4
3 4
5 6
5 6
5 6
7 8
6 7
6 7
7 8
9 10
9 10
8 9
10 11
10 11
12 13
11 12
11 12
13 14
13 14
12 13
15 16
15 16
14 15
16 17
17 18
17 18
16 17
18 19
19 20
17 18
19 20
20 21
21 22
19 20
21 22
20 21
23 24
21 22
23 24
22 23
23 24
24 25
24 25
25 26
26 27
27 28
27 28
27 28
29 30
...

output:

3

result:

ok 1 number(s): "3"

Test #58:

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

input:

700
1 2
2 3
2 3
1 2
3 4
4 5
3 4
5 6
6 7
4 5
5 6
7 8
8 9
6 7
7 8
9 10
9 10
8 9
11 12
11 12
11 12
12 13
12 13
13 14
13 14
14 15
14 15
13 14
14 15
15 16
17 18
15 16
16 17
17 18
19 20
17 18
18 19
18 19
19 20
19 20
20 21
20 21
21 22
21 22
23 24
22 23
25 26
25 26
25 26
26 27
27 28
26 27
26 27
27 28
28 29
...

output:

9

result:

ok 1 number(s): "9"

Test #59:

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

input:

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

output:

8

result:

ok 1 number(s): "8"

Test #60:

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

input:

900
1 2
1 2
2 3
2 3
3 4
2 3
4 5
3 4
5 6
6 7
7 8
6 7
7 8
6 7
9 10
8 9
10 11
10 11
9 10
10 11
10 11
12 13
12 13
11 12
13 14
13 14
14 15
14 15
14 15
16 17
15 16
15 16
16 17
18 19
19 20
17 18
20 21
20 21
20 21
21 22
21 22
22 23
23 24
21 22
23 24
22 23
23 24
24 25
24 25
25 26
25 26
27 28
28 29
28 29
27 2...

output:

22

result:

ok 1 number(s): "22"

Test #61:

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

input:

1000
1 2
1 2
3 4
3 4
3 4
4 5
4 5
4 5
5 6
4 5
7 8
6 7
6 7
6 7
7 8
9 10
8 9
8 9
11 12
9 10
11 12
11 12
11 12
12 13
13 14
13 14
15 16
14 15
16 17
15 16
15 16
17 18
16 17
18 19
17 18
17 18
18 19
20 21
20 21
20 21
22 23
22 23
22 23
23 24
24 25
23 24
24 25
24 25
25 26
26 27
26 27
25 26
26 27
28 29
27 28
2...

output:

1

result:

ok 1 number(s): "1"

Test #62:

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

input:

2000
2 3
1 2
1 2
1 2
3 4
4 5
4 5
3 4
5 6
4 5
6 7
6 7
8 9
8 9
9 10
8 9
9 10
10 11
11 12
11 12
10 11
11 12
13 14
12 13
12 13
13 14
14 15
15 16
14 15
15 16
16 17
15 16
17 18
17 18
19 20
19 20
19 20
20 21
19 20
19 20
20 21
20 21
23 24
22 23
23 24
22 23
25 26
25 26
24 25
26 27
26 27
25 26
27 28
27 28
29 ...

output:

6

result:

ok 1 number(s): "6"

Test #63:

score: 0
Accepted
time: 31ms
memory: 21712kb

input:

2000
181 1425
1803 1804
1465 1847
1816 1817
1839 1840
982 1906
1895 1896
1483 1524
1862 1863
848 1660
1846 1847
1847 1904
217 1638
1830 1831
1899 1900
1418 1675
1826 1827
518 1735
1270 1905
1861 1862
785 945
1851 1852
858 1083
1852 1853
853 1113
1877 1878
1230 1571
1882 1883
1865 1866
395 749
985 19...

output:

101

result:

ok 1 number(s): "101"

Test #64:

score: 0
Accepted
time: 15ms
memory: 22336kb

input:

2000
533 817
357 358
373 374
244 1651
438 439
1184 1859
348 349
1616 1968
339 340
891 1872
238 1929
364 365
202 1903
445 446
411 412
1251 1475
327 328
111 1761
505 506
1216 1708
476 477
1260 1911
1968 1969
319 320
1597 1748
379 380
1917 1949
336 337
344 345
1122 1358
1489 1939
435 436
464 465
477 10...

output:

201

result:

ok 1 number(s): "201"

Test #65:

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

input:

2000
601 1760
554 555
1804 1831
806 807
834 835
1246 1652
1749 1854
727 728
752 753
1355 1693
1363 1392
657 658
622 623
574 1918
1809 1963
772 773
707 708
1654 1992
1506 1795
662 663
488 1687
705 706
1894 1986
757 758
660 661
964 1302
828 829
1737 1846
630 631
1566 1948
631 632
938 1231
299 1624
566...

output:

301

result:

ok 1 number(s): "301"

Test #66:

score: 0
Accepted
time: 47ms
memory: 20264kb

input:

2000
493 1421
1235 1236
1427 1613
1017 1018
1244 1993
1097 1098
1114 1115
820 1412
1054 1055
409 1330
1356 1357
1708 1935
1285 1286
1311 1921
1523 1899
1312 1313
1905 1940
1027 1028
1493 1894
1238 1239
861 1634
1346 1347
1316 1317
1005 1036
139 458
989 990
1337 1338
1576 1701
1130 1654
1185 1186
127...

output:

401

result:

ok 1 number(s): "401"

Test #67:

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

input:

2000
1868 1869
754 908
1842 1843
1420 1794
1949 1950
1422 1653
1772 1773
899 1158
1689 1690
254 740
1638 1639
745 860
595 1269
1833 1834
1925 1926
72 1640
1090 1874
1960 1961
1141 1613
1604 1605
1864 1865
118 1950
902 994
1798 1799
17 1749
1630 1631
1621 1773
1850 1851
1869 1870
1418 1753
1578 1579
...

output:

501

result:

ok 1 number(s): "501"

Test #68:

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

input:

2000
1564 1703
1582 1583
1550 1551
693 1104
1337 1338
1961 1983
1233 1696
1166 1167
1161 1858
1477 1478
1434 1453
1592 1593
1794 1997
1456 1457
1480 1481
934 1967
1299 1533
1584 1585
1060 1369
1201 1202
1331 1332
685 1993
953 1995
1476 1477
1090 1091
1003 1885
1962 1986
1426 1427
1608 1609
670 1628
...

output:

601

result:

ok 1 number(s): "601"

Test #69:

score: 0
Accepted
time: 95ms
memory: 16164kb

input:

2000
425 457
1414 1415
1582 1583
1458 1828
135 1797
1553 1554
1481 1694
1427 1428
1154 1155
1909 1993
1384 1385
38 1128
753 1065
1155 1156
1861 1949
1480 1481
416 875
1101 1102
651 1349
1429 1430
1214 1499
1734 1735
1407 1700
1743 1744
833 1345
1091 1092
618 1254
1423 1424
1323 1324
784 1690
1573 18...

output:

701

result:

ok 1 number(s): "701"

Test #70:

score: 0
Accepted
time: 116ms
memory: 15336kb

input:

2000
619 620
517 879
379 1070
1164 1165
860 861
1027 1136
1915 1958
637 638
1375 1653
1169 1170
1631 1752
768 769
1967 1994
1153 1154
1191 1192
1895 1958
653 654
1123 1854
673 674
1802 1904
984 985
1276 1382
1254 1255
90 1655
1210 1211
1246 1513
563 1722
658 659
970 1646
1272 1273
1476 1523
920 921
...

output:

801

result:

ok 1 number(s): "801"

Test #71:

score: 0
Accepted
time: 107ms
memory: 16236kb

input:

2000
466 733
652 653
421 422
956 1892
580 581
1666 1757
1024 1025
1256 1585
2 1804
762 763
772 991
294 295
1069 1070
74 1852
856 857
1478 1823
1205 1544
905 906
1168 1463
884 885
1558 1837
799 800
1083 1577
1083 1084
739 740
770 783
786 787
1483 1989
1967 1992
329 330
701 1040
379 380
1029 1030
1577...

output:

802

result:

ok 1 number(s): "802"

Test #72:

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

input:

2000
1519 1520
177 1812
1421 1422
1984 1990
635 964
1607 1608
59 1643
1358 1359
1257 1258
1219 1996
290 1971
1649 1650
1871 1893
1326 1327
829 1419
1696 1697
838 1853
1860 1861
543 758
1800 1801
1719 1915
1148 1149
1319 1716
1766 1767
1735 1736
1583 1757
1295 1296
1185 1873
1699 1992
1740 1741
1377 ...

output:

811

result:

ok 1 number(s): "811"

Test #73:

score: 0
Accepted
time: 116ms
memory: 14928kb

input:

2000
1166 1167
1366 1720
639 1319
1358 1359
1566 1892
1686 1687
257 1700
1012 1013
1231 1232
1709 1725
1664 1982
1685 1686
1777 1996
1075 1076
1163 1164
1061 1229
993 994
697 1777
1403 1404
1306 1395
254 537
1469 1470
107 1849
1644 1645
1404 1405
1636 1930
750 1896
1692 1693
1924 1944
1416 1417
1598...

output:

821

result:

ok 1 number(s): "821"

Test #74:

score: 0
Accepted
time: 122ms
memory: 14804kb

input:

2000
776 1207
1598 1599
1106 1558
1048 1049
1962 1977
1192 1193
437 1543
1023 1024
993 994
127 1813
1140 1141
99 1532
995 996
87 316
1630 1631
1397 1434
1722 1819
1427 1428
625 1456
1540 1541
1371 1692
1122 1123
1478 1479
1443 1444
899 1939
1018 1019
1706 1949
985 986
1782 1870
1637 1638
422 687
136...

output:

831

result:

ok 1 number(s): "831"

Test #75:

score: 0
Accepted
time: 115ms
memory: 15096kb

input:

2000
736 737
1581 1872
1288 1810
1192 1193
1108 1774
697 698
484 485
1350 1639
1516 1956
1142 1143
949 1470
1072 1073
973 974
1180 1518
650 1645
1034 1035
356 1223
1237 1238
1344 1766
722 723
863 864
598 1353
821 822
1008 1136
598 599
1364 1910
831 832
1174 1980
1048 1459
1282 1283
1079 1080
442 112...

output:

841

result:

ok 1 number(s): "841"

Test #76:

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

input:

2000
384 385
860 1722
599 963
1051 1052
953 954
1160 1509
510 511
732 821
369 1144
878 879
670 875
372 373
606 1108
895 896
488 639
548 549
1710 1816
522 523
1369 1500
328 329
334 335
1038 1432
1120 1121
565 1918
36 1502
706 707
1125 1126
1293 1812
1334 1437
678 679
351 1909
866 867
1126 1127
1518 1...

output:

851

result:

ok 1 number(s): "851"

Test #77:

score: 0
Accepted
time: 125ms
memory: 14112kb

input:

2000
1794 1858
1520 1521
1941 1987
1243 1244
414 1498
1481 1482
710 1715
1145 1146
619 745
1104 1105
272 855
954 955
885 1566
1630 1631
436 1703
1562 1563
1286 1287
916 1651
1483 1484
1212 1553
1711 1850
1475 1476
1161 1162
190 906
1610 1611
750 1264
1223 1985
1578 1579
1124 1125
707 1336
694 1670
1...

output:

901

result:

ok 1 number(s): "901"

Test #78:

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

input:

2000
921 922
113 1749
1319 1320
575 876
1928 1980
852 853
820 1074
1412 1413
1938 1964
1526 1527
46 876
1314 1315
722 1453
1863 1864
1455 1456
129 1436
1299 1300
1402 1814
1610 1611
1023 1719
611 1414
901 902
1091 1092
817 1515
1214 1215
1896 1919
1959 1965
839 840
1269 1270
1502 1996
1931 1932
888 ...

output:

1101

result:

ok 1 number(s): "1101"

Test #79:

score: 0
Accepted
time: 262ms
memory: 26120kb

input:

2000
1577 1578
47 1010
1227 1228
1510 1521
863 1654
1549 1550
1407 1408
1402 1920
549 1910
900 901
740 1538
859 860
650 651
884 1721
1495 1575
1200 1201
818 819
596 1803
555 556
1619 1641
807 1421
801 802
1654 1655
1302 1415
1938 1944
1442 1443
1982 1993
1030 1031
1325 1326
1833 1895
1426 1771
1037 ...

output:

1201

result:

ok 1 number(s): "1201"

Test #80:

score: 0
Accepted
time: 295ms
memory: 24276kb

input:

2000
1491 1539
1813 1814
1629 1630
1340 1645
338 1173
1538 1539
1022 1023
1721 1864
1431 1432
114 1221
989 990
999 1393
1483 1988
1428 1429
642 643
1346 1820
1952 1958
982 983
899 900
109 1108
1359 1664
1406 1407
644 645
416 1471
1351 1410
1148 1149
1414 1415
595 1216
1218 1230
1304 1305
862 863
405...

output:

1301

result:

ok 1 number(s): "1301"

Test #81:

score: 0
Accepted
time: 322ms
memory: 23284kb

input:

2000
1895 1956
256 257
1923 1925
882 883
172 481
471 472
1285 1286
1042 1855
1512 1681
1245 1246
1103 1104
440 1001
655 656
930 1552
232 233
994 1001
395 396
1192 1634
275 494
1354 1355
984 985
1211 1723
722 723
614 816
47 1512
668 669
677 678
1940 1972
1080 1583
748 749
1586 1882
1401 1402
338 1532...

output:

1401

result:

ok 1 number(s): "1401"

Test #82:

score: 0
Accepted
time: 399ms
memory: 28792kb

input:

2000
996 1142
1220 1221
1307 1308
1916 1924
143 1185
1346 1347
358 1606
906 907
810 811
1383 1572
1791 1792
631 697
1520 1852
945 946
851 852
925 1554
1004 1005
770 1089
746 1984
1557 1558
1704 1928
1499 1500
898 1565
854 855
679 680
485 959
270 532
951 952
1279 1427
1847 1848
775 776
1523 1978
598 ...

output:

1501

result:

ok 1 number(s): "1501"

Test #83:

score: 0
Accepted
time: 454ms
memory: 27704kb

input:

2000
1781 1863
331 332
1406 1407
350 1702
298 299
1435 1468
869 870
1982 1997
443 1359
1612 1613
1436 1437
24 1018
1684 1685
206 675
1003 1004
1978 1985
756 757
1083 1375
875 876
1412 1715
1175 1176
1892 1944
712 713
1012 1310
304 1928
1644 1645
1134 1809
990 991
242 389
485 486
766 808
1505 1506
18...

output:

1601

result:

ok 1 number(s): "1601"

Test #84:

score: 0
Accepted
time: 463ms
memory: 25632kb

input:

2000
537 538
115 934
414 415
1305 1425
630 631
1621 1829
1360 1361
294 1097
509 646
1302 1303
1743 1793
1185 1186
1261 1643
957 958
1871 1872
977 1389
1878 1984
431 432
544 738
1088 1089
928 929
1317 1499
637 1908
1358 1359
1439 1440
882 1990
290 291
1168 1359
1363 1364
422 1514
658 784
1863 1864
10...

output:

1701

result:

ok 1 number(s): "1701"

Test #85:

score: 0
Accepted
time: 549ms
memory: 27720kb

input:

2000
1528 1760
1488 1489
1718 1797
757 758
1511 1850
709 710
1131 1132
1063 1798
1220 1476
1851 1852
897 898
1438 1831
1550 1551
561 1905
369 370
257 1369
908 962
884 885
430 1084
257 258
1562 1563
378 1431
1693 1941
1252 1253
540 541
915 1414
1334 1335
657 1585
1681 1682
827 957
1080 1881
816 817
9...

output:

1801

result:

ok 1 number(s): "1801"

Test #86:

score: 0
Accepted
time: 572ms
memory: 28572kb

input:

2000
760 1875
314 315
1933 1934
585 1157
943 944
905 1859
1865 2000
1934 1935
1128 1950
1218 1219
1896 1973
371 372
1019 1817
154 155
824 825
1272 1405
1734 1735
976 1000
597 598
575 1683
35 1846
223 224
1972 1987
691 692
1277 1890
253 254
830 831
822 1388
1348 1944
1859 1860
717 718
969 1953
1898 1...

output:

1901

result:

ok 1 number(s): "1901"

Test #87:

score: 0
Accepted
time: 621ms
memory: 29080kb

input:

2000
608 609
1112 1430
844 1713
146 147
509 1763
1512 1513
1660 1661
297 859
217 218
930 1118
873 1585
1687 1688
1557 1672
1632 1633
1696 1957
1409 1410
1558 1757
641 642
87 910
1352 1353
464 465
795 1306
977 978
1317 1475
144 1948
619 620
321 879
933 934
29 30
120 1133
1781 1782
247 1599
57 58
1134...

output:

1951

result:

ok 1 number(s): "1951"

Test #88:

score: 0
Accepted
time: 634ms
memory: 28292kb

input:

2000
998 999
448 1779
914 1321
1499 1500
1553 1554
1939 1999
1636 1839
1309 1310
964 965
1574 1631
710 711
1264 1753
3 1749
645 646
845 846
68 885
1103 1249
1475 1476
31 1559
1291 1292
605 1349
1424 1425
745 943
868 869
1015 1166
1667 1668
516 1072
1913 1914
32 33
1452 1862
14 15
358 744
102 103
129...

output:

1981

result:

ok 1 number(s): "1981"