QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#576708#5088. Two ChoreographiesNumbering#AC ✓359ms78260kbC++173.1kb2024-09-19 21:39:172024-09-19 21:39:18

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
1 3
1 4
2 3
2 4

output:

3
1 4 2 
1 3 2 

result:

ok 

Test #2:

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

input:

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

output:

3
1 5 2 
1 3 2 

result:

ok 

Test #3:

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

input:

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

output:

5
2 5 6 3 4 
1 2 5 6 3 

result:

ok 

Test #4:

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

input:

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

output:

4
5 27 7 11 
1 16 2 4 

result:

ok 

Test #5:

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

input:

201
1 7
1 114
1 119
2 49
2 93
4 197
5 139
6 1
6 27
7 39
7 121
8 127
9 130
9 145
11 106
11 136
11 193
12 2
12 116
13 55
13 69
13 105
13 187
13 196
14 144
14 177
15 127
15 134
15 145
15 155
15 184
15 199
16 96
16 177
17 20
21 100
22 68
22 71
22 81
22 142
23 148
23 190
24 12
24 81
24 89
25 158
25 159
2...

output:

23
13 196 94 84 118 92 76 146 69 67 183 101 62 28 37 44 122 78 83 38 98 126 55 
7 121 36 106 11 175 123 158 25 35 163 176 119 109 48 50 82 95 97 153 31 34 39 

result:

ok 

Test #6:

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

input:

8000
2 1508
2 3068
3 5268
3 5501
6 266
6 2737
6 3197
6 5863
6 6697
7 3492
9 427
9 794
9 3114
9 5509
10 2257
10 4348
11 1479
11 1957
11 2230
11 2500
11 3182
11 4399
11 5051
11 7727
12 7669
13 1403
13 5753
14 2871
14 6956
14 7959
15 6902
17 1630
17 3155
17 5950
18 7232
19 125
19 3280
19 5648
20 6879
2...

output:

614
71 6914 793 7015 2339 6171 4442 5580 100 5428 6180 4303 733 6896 7040 2389 4177 4290 126 6434 1317 4408 901 2796 4525 837 2763 679 3668 4312 2021 4587 7448 4323 4373 4765 6601 7343 6740 6020 3918 4659 4707 6981 2664 5975 5003 4320 6798 4102 3340 4874 378 1953 6357 7117 4196 6328 7551 4311 1443 4...

result:

ok 

Test #7:

score: 0
Accepted
time: 266ms
memory: 65516kb

input:

99999
1 11261
1 21544
2 9017
2 63063
2 97990
3 11995
3 42473
4 19846
5 38099
6 35872
6 80509
7 73231
8 12356
9 35384
10 45091
12 86727
13 4938
13 48917
14 62383
14 89846
15 28458
15 44277
15 51725
15 84522
16 93258
17 13934
17 42238
18 19000
19 11278
19 23672
19 61502
19 78791
20 85057
20 88080
21 2...

output:

4045
467 95325 94372 97839 70308 56055 29641 98858 70124 55819 75279 55768 90796 64145 22161 5147 60543 68575 55347 45343 12402 64480 37087 91206 72756 18202 63574 67203 94236 57420 98902 99805 90775 86812 10341 66677 55 70914 81577 6812 83832 95357 98362 71573 88850 83298 6565 89038 35567 63079 663...

result:

ok 

Test #8:

score: 0
Accepted
time: 278ms
memory: 65592kb

input:

100000
1 68531
2 97359
4 68578
4 83098
4 98443
5 8053
5 30270
5 86617
6 7074
6 12266
6 69396
7 52675
7 78316
7 90757
7 92242
8 32677
8 41353
8 41457
8 74508
9 44234
10 4973
10 38390
10 96049
11 28007
11 68620
13 3016
14 36748
15 8147
15 25110
15 28489
15 72947
15 99347
16 70760
17 12774
17 68407
17 ...

output:

10016
38 60220 80125 41622 79850 51590 3672 85014 74284 83669 87893 33227 36312 94954 71402 60385 58634 39027 89888 92449 47959 64848 85760 69323 46188 52786 22012 67242 85420 98130 84972 98989 75901 98280 74520 20308 45388 21169 33687 51875 60430 12121 88340 61591 38715 95098 44482 97012 59798 9757...

result:

ok 

Test #9:

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

input:

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

output:

3
5 6 7 
1 6 7 

result:

ok 

Test #10:

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

input:

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 52
52 5...

output:

3
1 3 2 
1 99999 100000 

result:

ok 

Test #11:

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

input:

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

output:

3
6 7 8 
1 2 8 

result:

ok 

Test #12:

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

input:

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

output:

3
1 3 2 
1 2 9 

result:

ok 

Test #13:

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

input:

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

output:

3
8 9 10 
1 9 10 

result:

ok 

Test #14:

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

input:

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
52 53
...

output:

3
1 3 2 
1 999 1000 

result:

ok 

Test #15:

score: 0
Accepted
time: 14ms
memory: 20464kb

input:

9999
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
52 53
...

output:

3
9997 9998 9999 
1 9998 9999 

result:

ok 

Test #16:

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

input:

10000
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
52 53...

output:

3
9998 9999 10000 
1 9999 10000 

result:

ok 

Test #17:

score: 0
Accepted
time: 150ms
memory: 74864kb

input:

94753
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
52 53...

output:

3
1 3 2 
1 94752 94753 

result:

ok 

Test #18:

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

input:

99999
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
52 53...

output:

3
1 3 2 
1 2 99999 

result:

ok 

Test #19:

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

input:

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

output:

3
1 3 2 
1 6 7 

result:

ok 

Test #20:

score: 0
Accepted
time: 123ms
memory: 77612kb

input:

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 52
52 5...

output:

3
1 3 2 
1 99999 100000 

result:

ok 

Test #21:

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

input:

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

output:

3
1 3 2 
1 7 8 

result:

ok 

Test #22:

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

input:

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

output:

3
1 3 2 
1 8 9 

result:

ok 

Test #23:

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

input:

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

output:

3
1 3 2 
1 9 10 

result:

ok 

Test #24:

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

input:

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
52 53
...

output:

3
1 3 2 
1 999 1000 

result:

ok 

Test #25:

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

input:

9999
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
52 53
...

output:

3
1 3 2 
1 9998 9999 

result:

ok 

Test #26:

score: 0
Accepted
time: 14ms
memory: 22696kb

input:

10000
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
52 53...

output:

3
1 3 2 
1 9999 10000 

result:

ok 

Test #27:

score: 0
Accepted
time: 126ms
memory: 76584kb

input:

97065
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
52 53...

output:

3
1 3 2 
1 97064 97065 

result:

ok 

Test #28:

score: 0
Accepted
time: 127ms
memory: 77844kb

input:

99999
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
52 53...

output:

3
1 3 2 
1 99998 99999 

result:

ok 

Test #29:

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

input:

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

output:

3
5 6 7 
1 2 7 

result:

ok 

Test #30:

score: 0
Accepted
time: 135ms
memory: 78076kb

input:

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 52
52 5...

output:

3
99998 99999 100000 
1 2 100000 

result:

ok 

Test #31:

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

input:

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

output:

3
6 7 8 
1 2 8 

result:

ok 

Test #32:

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

input:

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

output:

3
7 8 9 
1 2 9 

result:

ok 

Test #33:

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

input:

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

output:

3
8 9 10 
1 2 10 

result:

ok 

Test #34:

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

input:

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
52 53
...

output:

3
998 999 1000 
1 2 1000 

result:

ok 

Test #35:

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

input:

9999
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
52 53
...

output:

3
9997 9998 9999 
1 2 9999 

result:

ok 

Test #36:

score: 0
Accepted
time: 11ms
memory: 22496kb

input:

10000
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
52 53...

output:

3
9998 9999 10000 
1 2 10000 

result:

ok 

Test #37:

score: 0
Accepted
time: 111ms
memory: 73476kb

input:

92892
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
52 53...

output:

3
92890 92891 92892 
1 2 92892 

result:

ok 

Test #38:

score: 0
Accepted
time: 134ms
memory: 78260kb

input:

99999
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
52 53...

output:

3
99997 99998 99999 
1 2 99999 

result:

ok 

Test #39:

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

input:

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

output:

4
6 7 3 2 
7 8 2 3 

result:

ok 

Test #40:

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

input:

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

output:

4
5 2 4 10 
2 4 10 3 

result:

ok 

Test #41:

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

input:

1000
272 271
393 394
369 404
981 980
169 185
362 361
387 386
482 481
383 382
370 788
266 106
938 223
876 877
107 106
109 110
481 480
633 14
886 885
588 589
673 567
568 693
531 932
562 561
871 872
89 959
951 950
119 556
484 891
981 271
75 74
443 444
865 730
374 15
580 233
716 165
882 829
622 623
606 ...

output:

416
270 269 268 267 169 185 240 239 463 253 20 21 856 987 349 348 543 644 803 804 791 352 351 536 537 909 134 135 826 845 914 314 313 995 610 570 797 798 799 800 307 559 638 339 340 52 287 288 289 126 723 724 693 568 567 673 674 842 841 199 919 920 528 671 670 669 549 550 551 552 515 514 932 531 470...

result:

ok 

Test #42:

score: 0
Accepted
time: 20ms
memory: 17912kb

input:

9999
1503 1502
1862 3917
4579 4578
9929 8919
4989 4990
4479 7716
5512 5511
4389 4390
4430 910
5616 3889
5708 5879
8848 8849
5400 5076
7827 3718
1169 1168
1574 213
3196 4013
2414 2415
2857 2858
9177 9178
7189 7190
3550 3549
7446 5351
7766 8059
2132 2646
8813 7870
2521 2522
5158 5157
4623 4624
4957 49...

output:

1832
4776 5814 5813 5812 7713 7714 1675 797 1938 4377 8175 8176 8177 5970 5969 3282 3281 3280 3260 3261 3262 1901 8686 5763 5762 1195 5172 5171 5170 5169 5168 7602 7601 8674 8675 8676 8677 8678 547 548 549 550 551 552 2217 2218 8455 9113 9112 733 732 731 730 729 728 727 1679 1678 1677 6122 2033 3246...

result:

ok 

Test #43:

score: 0
Accepted
time: 13ms
memory: 17948kb

input:

10000
5462 4989
4542 4541
7300 8478
4730 3574
7930 7051
750 7627
117 3045
4274 4275
3840 3841
5706 3638
7108 7107
28 29
2564 2563
2784 2393
1193 1192
2040 1286
3688 3687
8048 2319
2404 2405
8641 8640
6992 8729
5085 5086
5130 5131
6813 9806
6592 6769
2806 2805
7482 6021
7371 3994
4939 3217
1905 6540
...

output:

617
407 2493 2494 2495 1713 1714 1715 4513 4514 9962 4898 4899 2014 6277 4411 2386 2385 8375 8376 8003 8002 9785 6401 6402 2435 9666 9665 9664 2679 2678 2677 2676 8815 8814 8813 8812 8811 3789 3788 3787 3786 9121 9122 1568 1569 9865 9866 9867 3028 214 215 4571 6651 9259 9258 9257 1211 1212 1213 9358...

result:

ok 

Test #44:

score: 0
Accepted
time: 355ms
memory: 72296kb

input:

99999
49253 51314
3093 3092
88617 72981
43336 77222
65739 55450
5166 90677
57235 57234
51512 51511
73274 86124
86611 77777
21808 21809
2794 2795
64109 69571
80102 80101
56177 27689
55899 58255
16908 16909
53732 53733
9213 9214
33157 33158
10706 10707
76016 11308
51459 74662
58149 58150
80976 56845
2...

output:

21824
69571 47415 47414 47413 47412 47411 63677 63676 12073 60684 45858 29046 29045 29044 28982 28981 65124 68818 56347 56348 46751 46752 81248 74224 74223 74222 87960 87961 87962 11458 8656 32236 80645 58070 47515 47514 73109 73108 73107 20328 20329 20330 9455 9454 17457 63912 63913 63914 63915 639...

result:

ok 

Test #45:

score: 0
Accepted
time: 323ms
memory: 71404kb

input:

96827
15894 15895
33528 48199
50450 50451
63703 63702
49937 31980
93823 45726
96052 96051
54334 16426
9193 11656
49315 10079
10614 33488
84027 84028
3612 5321
64903 64904
56901 32611
33578 68521
47938 47939
32618 53239
89613 89612
82729 82728
34512 34511
54064 38673
56419 56420
23775 75336
85989 172...

output:

7342
53167 60412 60411 46748 10639 10640 10641 57719 14622 14621 14620 14619 70143 70142 6828 6827 32377 72351 72352 72353 72354 95436 95437 95438 95439 17494 17256 17255 80253 80252 80251 19931 19932 19933 39405 39406 42305 790 789 788 787 19755 19756 41628 41627 41626 41625 32049 93213 93214 59251...

result:

ok 

Test #46:

score: 0
Accepted
time: 303ms
memory: 72884kb

input:

100000
72105 72104
4352 4351
59159 59160
78993 64103
39235 39234
4458 36615
23543 53027
54635 54634
80821 80822
8720 72158
49535 78364
64357 3035
93490 6597
52195 13285
70186 70187
14748 98067
15516 71738
77617 77616
68836 68835
61569 61570
28477 28289
50823 50822
71759 49859
59464 59463
83701 83702...

output:

22724
61034 71121 51799 51800 20379 20380 44238 44239 49202 49203 19659 19660 19661 19662 28349 28348 7458 36793 36794 36795 53939 53940 53941 20358 20357 7691 7692 7693 7694 7695 88933 88932 88931 48524 48525 14833 46953 46952 46951 22210 22209 25952 25953 97887 9366 9365 36949 40270 40269 40268 40...

result:

ok 

Test #47:

score: 0
Accepted
time: 308ms
memory: 72676kb

input:

100000
53877 17887
7877 7878
35510 37710
15520 83926
7572 7573
11839 11840
75139 75140
63678 63679
66199 66198
3262 3263
78203 78204
87574 87575
53474 67658
86593 86594
28943 17005
71369 264
3802 41402
30583 30584
38511 38510
36776 90902
57208 57209
15408 48313
73488 46167
88419 93118
57411 57412
42...

output:

15240
83671 85227 85228 20737 20738 20739 20740 20741 20742 20743 79951 79950 79949 79948 79947 35257 35256 35255 8435 8434 2512 88569 53228 53229 53230 53231 90932 90931 6266 59372 59373 39191 39190 39189 39188 39187 39186 23432 543 544 545 49493 8180 20570 99354 99353 99352 32572 12710 12709 12708...

result:

ok 

Test #48:

score: 0
Accepted
time: 306ms
memory: 72568kb

input:

100000
78895 34726
20392 44705
57147 22069
31133 31132
78946 78947
53758 53757
68970 68971
75904 87094
12439 12438
92849 92848
80817 80818
76732 53635
79930 79931
78362 78363
87661 87662
47807 47808
73696 27386
30646 30645
17648 81813
47120 47119
84905 84906
87235 8058
8238 88843
86537 12191
68784 6...

output:

21565
73476 51258 51259 60132 60133 60134 60135 60136 60137 60138 60139 7140 7139 20063 75652 2825 2826 2827 35201 35200 35199 35198 35197 35196 35195 35194 35193 35192 22068 22069 57147 57146 57145 44720 44721 48087 14577 14576 14575 84523 84524 84525 24355 80078 80077 80076 57879 57878 53060 53059...

result:

ok 

Test #49:

score: 0
Accepted
time: 292ms
memory: 70256kb

input:

94055
34740 73546
30256 30255
20298 20299
62592 62591
49467 49468
65041 2277
38788 38787
58735 65469
2375 2376
77665 77666
36242 80298
75550 16701
13820 64701
83448 83449
79313 83990
2213 2212
22172 22171
72441 92184
10391 30730
39194 38883
25064 90160
69140 85068
50433 31078
58353 4381
38997 38998
...

output:

3603
55104 79704 46944 46943 46942 28417 28418 83346 74526 74527 74528 74529 68665 68666 68667 68668 68669 68670 68671 16743 40351 87726 87803 87804 87805 26971 26970 74074 74075 74076 92399 45703 45704 72970 39752 39751 63768 63767 34012 22861 22862 22863 22864 47646 47647 20314 38610 26208 26207 2...

result:

ok 

Test #50:

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

input:

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

output:

4
2 3 7 6 
7 3 4 5 

result:

ok 

Test #51:

score: 0
Accepted
time: 330ms
memory: 72316kb

input:

99084
7128 52592
26282 84361
19470 70586
2431 2430
33596 72767
70001 70000
65483 65484
76493 76492
62792 39465
4476 31233
72512 72511
94244 69778
84662 84663
32214 32213
4717 4718
73918 26226
71389 71390
45765 45764
87589 87590
6207 6206
47094 70119
30908 29826
34602 40286
44413 44412
21890 21889
24...

output:

8286
29352 29353 29354 8517 8516 84278 84277 84276 84275 84274 52716 89224 48092 47797 47798 81936 81935 17309 72032 72033 1911 22265 22266 82108 82109 46573 46574 34340 34339 68690 60959 60960 60961 35003 62451 62450 62449 74040 17517 17518 56803 56804 14146 14147 14148 8577 44984 4696 85588 85587 ...

result:

ok 

Test #52:

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

input:

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

output:

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

result:

ok 

Test #53:

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

input:

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

output:

5
7 8 9 4 3 
6 7 3 4 5 

result:

ok 

Test #54:

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

input:

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

output:

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

result:

ok 

Test #55:

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

input:

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

output:

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

result:

ok 

Test #56:

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

input:

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

output:

5
5 6 8 7 4 
2 9 8 6 5 

result:

ok 

Test #57:

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

input:

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

output:

4
2 5 4 3 
1 2 3 4 

result:

ok 

Test #58:

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

input:

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

output:

3
7 8 9 
4 6 3 

result:

ok 

Test #59:

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

input:

4
1 2
4 1
4 3
3 1
4 2

output:

3
1 2 4 
1 3 4 

result:

ok 

Test #60:

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

input:

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

output:

4
3 4 10 8 
10 9 6 5 

result:

ok 

Test #61:

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

input:

1000
937 387
833 217
405 422
502 356
529 374
497 662
803 845
726 979
999 43
463 620
749 828
661 573
191 708
513 963
737 819
439 571
787 166
873 842
993 566
590 908
34 184
699 314
756 255
996 242
653 402
451 656
90 762
562 382
945 397
600 816
789 890
378 965
613 827
319 645
156 684
477 570
131 419
43...

output:

73
432 50 723 277 761 520 964 249 457 10 350 908 590 212 503 512 290 1000 316 731 829 16 879 265 398 83 447 119 240 177 103 971 197 186 728 824 697 187 312 348 674 815 271 246 431 272 910 371 851 575 779 943 789 543 833 217 325 614 553 259 870 5 994 418 100 670 917 22 236 832 93 238 814 
652 4 258 8...

result:

ok 

Test #62:

score: 0
Accepted
time: 14ms
memory: 20096kb

input:

9999
2524 8191
1533 7530
356 1008
8210 3560
2071 540
2876 4324
9158 3771
2872 5625
4701 4769
4728 2104
2264 9841
4009 2392
9900 4852
9836 1027
3996 1557
97 1319
5587 7722
7488 4073
2940 9762
246 6394
380 6935
7929 3557
8049 8841
2105 7255
2710 6626
7926 6255
8392 6949
6174 2040
9959 8955
8701 3730
5...

output:

4410
6853 2142 5634 1170 5915 7077 334 4570 7079 9483 6369 3883 1216 1387 787 2039 6596 3803 7317 8322 2827 9816 9748 2540 7350 7503 9310 8784 610 9821 8795 3625 7202 5780 9938 5676 788 1112 8244 1916 9306 851 1927 5304 4696 1786 9517 3215 3495 2786 5580 5217 3268 2829 5464 1353 8584 4676 8230 4981 ...

result:

ok 

Test #63:

score: 0
Accepted
time: 22ms
memory: 22032kb

input:

10000
8697 615
9680 5350
5924 4698
4478 7356
3510 7535
6046 3305
885 4890
8224 2297
2267 8411
7331 7035
1747 7766
3540 1409
4143 212
9541 5746
1062 539
2060 9566
5293 350
6143 2220
1446 2866
4603 4151
9625 5078
3432 4169
1528 1525
9522 2738
3154 3100
8560 9024
1200 4420
3138 9200
2346 182
1694 6303
...

output:

3059
8407 711 1918 9870 939 2876 1023 8025 714 3344 9227 9501 909 5020 6258 5817 3751 1425 10 9956 799 3471 4287 6795 6395 3577 497 2398 2400 3982 6075 9763 7908 7465 3045 3840 6947 6870 5705 304 8435 1373 9473 764 3133 6881 6126 7876 4821 3015 73 5568 5753 3892 3876 1674 3737 3772 495 2616 7616 527...

result:

ok 

Test #64:

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

input:

99999
84520 53880
95569 33800
30674 78149
34453 98159
29766 87018
38710 45543
78103 64279
95388 6083
90709 6245
28076 59536
89121 25989
17455 86681
24869 49677
88947 54071
59069 14675
2211 80543
84618 24731
71749 96646
3072 81888
41124 19659
78748 83891
86353 92485
51719 3101
86489 39980
2846 67916
...

output:

4281
12722 35581 86314 43212 52412 91891 38159 24686 89773 28456 51868 4083 21083 15145 7326 23143 92962 71475 49525 64677 78617 84986 25139 15463 83714 82129 16070 24840 39226 13040 93422 15875 55447 94850 52176 50633 8072 83114 12016 94408 7633 74379 16389 27514 47066 84852 4999 57426 573 96894 80...

result:

ok 

Test #65:

score: 0
Accepted
time: 317ms
memory: 66808kb

input:

91648
4472 25803
85060 29770
38233 78885
69505 11992
74584 56733
44447 19721
38611 47816
64374 1051
85078 88959
3376 77926
30914 66149
47776 2665
24048 19740
63674 58321
31035 27289
28597 78620
26732 63968
3921 28544
88344 48945
17800 78918
39469 31300
58279 76356
88378 67190
87900 74995
96 31664
86...

output:

16895
46665 69990 63760 74665 86200 32066 41101 31840 54022 29181 10635 69856 84749 40725 84973 44421 48415 73359 18570 33056 1930 20305 55463 14394 54962 64596 83495 65670 71613 15597 65396 78952 26369 32672 19369 47715 43618 15846 41942 6963 90445 88304 1035 37340 33973 52548 14392 84646 19294 943...

result:

ok 

Test #66:

score: 0
Accepted
time: 357ms
memory: 71012kb

input:

100000
13352 1027
26975 28733
58784 97055
76806 68544
9735 23022
13365 25281
80851 10373
95287 91860
59771 31042
51912 68412
26741 29961
34375 25709
13755 46111
50736 39736
95695 18184
57397 62912
97590 59408
6754 50322
16563 80551
76371 58366
31788 49867
41825 95414
16211 24996
32999 62870
4946 820...

output:

2538
93412 16432 13603 60683 78573 8575 58729 3218 18995 99725 12754 25135 52218 38431 57499 3592 65916 30536 62848 9995 54047 15872 26121 66505 16872 60189 37930 61268 51281 50921 75331 54692 62999 74515 83221 33383 71098 4740 83791 47692 26162 4546 81046 20787 88587 34047 99603 30748 23470 29912 8...

result:

ok 

Test #67:

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

input:

100000
20959 25336
91898 62660
72720 51175
61002 85224
24094 15898
17841 75902
96298 91723
60352 50707
73566 69660
14089 5220
50982 29437
79898 86395
1734 56103
52555 46603
63369 73948
72151 60200
25210 3152
38452 28051
85173 32730
57691 99457
69691 30053
2072 97708
97968 56344
65532 44367
12342 346...

output:

14176
35920 37903 33917 11121 38364 15805 75805 60227 59826 87569 94422 87445 12881 72652 66792 59444 11260 61901 40768 64325 41233 80917 11058 40709 82597 70975 47651 52957 36961 97770 20842 67289 95003 74355 51309 86596 53339 29694 90340 14202 44495 64694 73276 93581 97891 28229 56379 4768 68502 1...

result:

ok 

Test #68:

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

input:

100000
16435 98228
89180 57831
43189 90862
16293 29922
91964 47722
34278 901
54950 37026
95302 76757
42452 74646
38280 38053
65541 27258
36041 61691
27600 40344
23817 62272
71323 52794
81547 61348
39381 11415
52865 23221
79787 93823
91146 34985
66479 79975
16439 79659
36874 49350
50891 86175
33479 5...

output:

21220
7543 43357 33395 41677 425 43002 98543 39046 11625 55304 91963 35561 22921 5636 87813 4836 59614 94593 73952 39181 90738 54789 55236 70441 11021 24283 10815 72014 16379 63603 45038 22489 25022 42339 89737 39740 44307 50037 38500 62563 27766 17957 18990 56918 47831 4997 90128 4627 25588 77905 1...

result:

ok 

Test #69:

score: 0
Accepted
time: 357ms
memory: 69044kb

input:

95728
48566 69797
54999 85490
75942 40279
51954 81016
58241 2418
39067 29211
81791 12312
77375 65571
56275 38417
19545 83406
22125 73565
35590 62148
23344 55309
39501 86411
68603 19541
75927 74829
9467 14763
65439 91977
45467 52791
94490 35940
32928 3568
76229 95312
78704 76042
23090 10023
59356 602...

output:

11287
81855 55055 6618 36640 75778 5516 46703 9267 4259 33031 84911 41525 38074 51273 46094 8767 59118 72373 43314 85988 51554 81865 75727 76243 10065 39520 2022 72455 34905 61784 6813 41747 76554 1066 24263 81140 74111 38166 11385 15378 9781 30554 70434 68407 83335 18362 16206 71335 86159 53474 254...

result:

ok 

Test #70:

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

input:

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

output:

4
1 2 3 5 
5 3 2 4 

result:

ok 

Test #71:

score: 0
Accepted
time: 333ms
memory: 67200kb

input:

93309
71437 20546
7225 87604
42872 46689
48394 70601
79628 80229
46286 21730
85596 24788
78402 13849
4309 88242
46678 82455
59146 64364
43993 73409
35381 77031
24159 45740
49493 15690
53789 31467
78790 88954
13595 76316
85033 35716
5254 44215
33086 43366
81849 23644
22197 53918
78118 73130
44242 230...

output:

785
49265 35570 92217 79031 79006 27107 9176 87032 22159 87926 11882 14959 35362 53976 91030 38522 61146 68231 54007 15232 36707 46293 12495 10151 90723 79770 52587 82155 67101 92803 7964 53924 3521 51726 3509 64087 33680 81308 65024 21410 39748 75736 3481 81665 969 927 66797 80591 68860 66810 8779 ...

result:

ok 

Test #72:

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

input:

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

output:

3
3 6 5 
1 3 5 

result:

ok 

Test #73:

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

input:

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

output:

4
7 3 5 2 
1 6 3 7 

result:

ok 

Test #74:

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

input:

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

output:

3
5 7 6 
7 3 6 

result:

ok 

Test #75:

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

input:

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

output:

3
8 9 5 
4 8 5 

result:

ok 

Test #76:

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

input:

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

output:

7
8 9 10 6 5 4 7 
3 4 5 6 10 9 8 

result:

ok 

Test #77:

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

input:

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

output:

4
6 4 2 3 
5 2 3 6 

result:

ok 

Test #78:

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

input:

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

output:

3
10 4 2 
3 8 6 

result:

ok