QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#432290#5088. Two Choreographiesucup-team572#AC ✓43ms17744kbC++202.4kb2024-06-07 01:50:382024-06-07 01:50:39

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
1 3
1 4
2 3
2 4

output:

3
2 1 3 
4 2 1 

result:

ok 

Test #2:

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

input:

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

output:

3
1 3 2 
4 1 3 

result:

ok 

Test #3:

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

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:

4
5 1 2 6 
3 4 5 1 

result:

ok 

Test #4:

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

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:

7
3 38 18 9 39 34 25 
38 18 9 39 34 25 31 

result:

ok 

Test #5:

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

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:

8
52 189 149 68 142 22 49 2 
139 5 120 63 174 189 149 68 

result:

ok 

Test #6:

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

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:

139
6258 3508 3283 4737 2700 415 2400 7934 3602 7484 7384 4135 3029 5507 3327 4428 7057 7905 1636 6460 4743 6458 6803 4954 5493 4557 5459 1166 473 1591 2814 1568 1518 3675 1932 6809 1649 4750 33 1616 4267 289 3349 5065 1220 3795 6540 4973 3558 5085 3080 4499 4825 4316 982 7049 6519 3433 7929 7129 17...

result:

ok 

Test #7:

score: 0
Accepted
time: 43ms
memory: 12088kb

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:

568
42962 63148 5476 38305 91866 58874 34987 76732 67193 91572 13746 73435 7108 12989 54149 49185 57364 27974 81810 40195 89834 36018 29210 37734 87094 10053 61861 11305 95742 99206 75182 86986 85014 16542 88291 41640 17281 72053 68680 42403 57854 15143 53362 63027 53421 85994 9914 61163 56733 69770...

result:

ok 

Test #8:

score: 0
Accepted
time: 35ms
memory: 11676kb

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:

331
14709 68376 92743 10438 59618 45912 78637 93574 95011 81571 36488 27510 87340 68026 15469 64061 58121 83782 80397 78015 86269 34155 13462 33426 83902 34193 94957 32478 86011 50526 22591 27718 85518 87418 37819 4365 7831 93043 66388 92364 74354 56108 88558 89196 72935 74351 79742 92281 11597 4261...

result:

ok 

Test #9:

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

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
6 7 5 
1 6 7 

result:

ok 

Test #10:

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

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:

28
61860 61861 61862 61863 61864 61865 61866 61867 61868 61869 61870 61871 61872 61873 61874 61875 61876 61877 61878 61879 1 50457 50458 50459 50460 50461 50462 100000 
61853 61854 61855 61856 61857 61858 61859 61860 61861 61862 61863 61864 61865 61866 61867 61868 61869 61870 61871 61872 61873 61874...

result:

ok 

Test #11:

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

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
1 8 4 
2 1 8 

result:

ok 

Test #12:

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

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
4 3 1 
2 3 1 

result:

ok 

Test #13:

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

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:

4
2 1 4 3 
1 4 3 10 

result:

ok 

Test #14:

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

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:

25
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1000 696 695 694 693 692 691 690 1 
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1000 

result:

ok 

Test #15:

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

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:

33
3046 3045 3044 3043 3042 3041 3040 3039 3038 3037 3036 3035 3034 3033 3032 3031 3030 3029 3028 3027 3026 3025 3024 3023 3022 3021 3020 3019 9999 7613 7612 7611 1 
3050 3049 3048 3047 3046 3045 3044 3043 3042 3041 3040 3039 3038 3037 3036 3035 3034 3033 3032 3031 3030 3029 3028 3027 3026 3025 3024...

result:

ok 

Test #16:

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

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:

30
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 10000 7673 7672 7671 7670 7669 7668 1 
1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 100...

result:

ok 

Test #17:

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

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:

43
44542 44543 44544 44545 44546 44547 44548 44549 44550 44551 44552 44553 44554 44555 44556 44557 44558 44559 44560 44561 44562 44563 44564 44565 44566 44567 44568 44569 44570 44571 44572 44573 44574 44575 44576 94753 61515 61514 61513 61512 61511 61510 1 
44535 44536 44537 44538 44539 44540 44541 ...

result:

ok 

Test #18:

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

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:

5
34201 34200 34199 34198 99999 
61549 61548 61547 61546 1 

result:

ok 

Test #19:

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

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
6 7 1 
3 2 1 

result:

ok 

Test #20:

score: 0
Accepted
time: 30ms
memory: 15692kb

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
76009 76008 1 
76007 76008 1 

result:

ok 

Test #21:

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

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
3 1 4 
2 3 1 

result:

ok 

Test #22:

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

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:

4
5 6 7 1 
8 7 1 9 

result:

ok 

Test #23:

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

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:

4
5 1 3 4 
7 6 5 1 

result:

ok 

Test #24:

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

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:

4
349 350 351 1 
353 352 351 1 

result:

ok 

Test #25:

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

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:

5
7917 7916 7915 7914 1 
7911 7912 7913 7914 1 

result:

ok 

Test #26:

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

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
7922 7921 1 
7920 7921 1 

result:

ok 

Test #27:

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

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
76009 76008 1 
76007 76008 1 

result:

ok 

Test #28:

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

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:

6
76004 76005 76006 76007 76008 1 
76012 76011 76010 76009 76008 1 

result:

ok 

Test #29:

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

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
7 6 5 
3 2 7 

result:

ok 

Test #30:

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

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:

6
33621 33622 33623 33624 33625 100000 
33629 33628 33627 33626 33625 100000 

result:

ok 

Test #31:

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

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
3 2 8 
1 2 8 

result:

ok 

Test #32:

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

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
5 6 9 
7 6 9 

result:

ok 

Test #33:

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

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
3 2 10 
1 2 10 

result:

ok 

Test #34:

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

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:

4
695 696 697 1000 
699 698 697 1000 

result:

ok 

Test #35:

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

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
6131 6132 9999 
6133 6132 9999 

result:

ok 

Test #36:

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

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
6129 6130 10000 
6131 6130 10000 

result:

ok 

Test #37:

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

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:

4
19406 19407 19408 92892 
19410 19409 19408 92892 

result:

ok 

Test #38:

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

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
33621 33622 99999 
33623 33622 99999 

result:

ok 

Test #39:

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

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:

3
8 1 5 
2 8 1 

result:

ok 

Test #40:

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

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:

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

result:

ok 

Test #41:

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

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:

137
415 414 814 813 812 811 810 809 808 106 107 759 760 761 70 69 659 658 657 656 655 654 337 338 339 340 908 907 151 150 149 232 233 234 678 679 193 771 783 784 785 786 787 788 370 27 28 647 180 179 142 141 140 98 97 96 95 94 93 92 91 245 246 247 105 992 991 990 585 584 78 590 589 588 587 61 62 220...

result:

ok 

Test #42:

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

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:

327
9991 9992 137 4387 4388 4971 4970 2345 7924 7923 2254 2253 2252 2251 7131 1321 1320 487 486 9396 1895 5714 5713 727 1807 1806 5154 7410 7229 7230 7231 7232 7233 7234 577 578 9757 780 8376 6559 1800 1799 3787 3788 8228 2424 2425 3944 3945 3946 6942 3319 3320 6976 6977 7367 7885 7884 7883 3793 575...

result:

ok 

Test #43:

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

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:

115
1412 1413 1421 1922 4526 3852 3851 994 7704 2800 2799 2798 2797 2796 5763 5015 6807 9465 9466 9467 4919 4918 4917 340 5562 4282 4281 7861 7862 4436 2060 729 730 249 3949 9116 9117 8119 8118 8117 1764 9642 1013 1012 5219 5220 8126 8238 4797 6676 634 1825 4023 4024 4025 4026 4027 1474 1473 3337 90...

result:

ok 

Test #44:

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

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:

1130
35375 35374 29026 29027 29028 90765 19819 19818 19817 35397 35396 35395 19662 70853 70854 15484 15485 15486 15487 25619 25620 25621 84522 84523 84524 84525 79526 19693 19692 19691 19187 78000 78001 61123 61122 61121 61120 11368 11367 11366 36825 8656 11458 11457 11456 87227 87226 95489 67954 31...

result:

ok 

Test #45:

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

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:

253
83524 89183 14191 50224 50225 50226 50227 50228 24157 25690 50549 54705 54704 697 696 26193 6871 6872 14557 15006 60462 60463 60464 60465 60466 77958 60966 71127 95043 34045 23147 23148 18631 72838 72837 11364 62961 62960 95807 95806 95805 38447 64228 64227 64226 27186 27187 35661 86372 6710 385...

result:

ok 

Test #46:

score: 0
Accepted
time: 41ms
memory: 12572kb

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:

512
16773 27189 27190 12852 12853 3784 3785 3786 50498 50497 5724 5725 5726 36242 36241 46887 46888 46889 22657 61904 61903 61902 91810 41666 41665 31847 31848 15367 5654 85648 85649 75797 75796 95532 95531 95530 95529 95528 95527 62981 36201 36202 36203 34302 34303 58429 58428 58427 56340 56341 191...

result:

ok 

Test #47:

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

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:

554
91528 91527 61401 13142 13143 52637 49468 49467 15088 34795 34794 12751 53489 45214 45215 45216 45217 45218 57104 57105 71376 63979 63978 66671 66672 66673 66674 66675 66676 66677 87737 18711 18710 52464 64198 64197 90252 90253 95672 59374 59375 93252 93251 84508 84509 34977 34978 48536 48535 48...

result:

ok 

Test #48:

score: 0
Accepted
time: 42ms
memory: 12432kb

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:

407
76681 39502 87954 44660 99440 99439 55253 38375 72343 72344 42887 42888 62886 59196 59988 59987 62977 18457 18458 57048 57047 81841 81840 81839 81838 65074 65075 85740 85741 81704 27341 27342 27343 27344 47118 47119 17674 17673 93387 86707 86708 72298 72299 72300 69026 69027 69028 87172 87173 87...

result:

ok 

Test #49:

score: 0
Accepted
time: 30ms
memory: 12708kb

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:

5835
20153 36313 36314 57867 57868 57869 59451 59452 11185 75652 75653 4000 41647 45140 45139 45138 11265 31227 31226 20529 20530 20531 91982 30460 30461 75487 75486 22155 22154 22153 15714 15715 54908 54909 82350 82351 61053 61052 61051 61050 77765 51016 51015 16481 16480 31164 31163 81214 81213 12...

result:

ok 

Test #50:

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

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
5 1 2 6 
7 5 1 2 

result:

ok 

Test #51:

score: 0
Accepted
time: 42ms
memory: 12572kb

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:

1645
20494 20493 4197 3524 3525 3526 23274 35200 35199 35198 35197 35196 35195 35194 35193 75115 45819 45818 13464 13463 24491 24492 24493 61512 61511 93622 82261 88964 75015 75014 11122 11121 11120 71764 71765 73966 73965 73964 73963 70451 70450 65377 73329 22063 22064 67334 39041 17927 17928 77912...

result:

ok 

Test #52:

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

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:

4
1 8 7 6 
4 2 1 8 

result:

ok 

Test #53:

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

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:

4
8 7 6 9 
2 3 7 6 

result:

ok 

Test #54:

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

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:

5
5 7 8 1 9 
6 3 4 5 7 

result:

ok 

Test #55:

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

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:

4
6 7 8 4 
5 6 7 8 

result:

ok 

Test #56:

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

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:

4
2 3 4 5 
1 2 3 4 

result:

ok 

Test #57:

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

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
1 4 3 10 
2 1 4 3 

result:

ok 

Test #58:

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

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
8 7 9 
1 2 3 

result:

ok 

Test #59:

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

input:

4
1 2
4 1
4 3
3 1
4 2

output:

3
2 1 4 
1 4 3 

result:

ok 

Test #60:

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

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:

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

result:

ok 

Test #61:

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

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:

27
186 263 603 421 724 307 226 657 631 844 356 503 512 290 1000 960 998 525 955 772 622 467 752 969 304 786 197 
895 322 580 792 911 164 397 405 202 445 816 600 219 110 341 820 370 771 277 684 635 492 845 986 419 131 737 

result:

ok 

Test #62:

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

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:

42
1993 7386 9847 4809 184 8292 3422 9659 549 3217 9051 4001 1658 2120 6308 9448 4999 4876 6356 5642 6693 3797 246 1317 3670 8776 4988 4316 3677 8051 4090 7479 255 2221 3057 1444 4117 9967 9920 9141 4356 7768 
7490 8106 556 6730 6476 6533 356 1008 5889 7210 3352 9497 6785 3354 4973 5013 1647 3074 75...

result:

ok 

Test #63:

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

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:

533
9331 3664 8699 8397 962 934 3973 65 1095 6648 9472 5977 1848 825 6979 8570 2081 2710 3236 8652 5255 3371 9662 4373 2493 3034 4561 8164 9650 9946 9537 8883 2963 595 3702 7317 8459 1315 9511 8170 3581 4573 5137 6546 827 1864 5336 6924 4179 6234 2016 4979 7450 3784 9359 8365 5559 413 9906 6805 3691...

result:

ok 

Test #64:

score: 0
Accepted
time: 41ms
memory: 12728kb

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:

351
60933 73307 96958 25211 46196 18211 77408 56383 55458 26732 60146 4583 68872 69991 6968 19860 86359 39510 65263 10083 44267 4766 95080 5974 29090 77001 90094 63519 26465 95459 81144 38750 49903 50431 47150 57993 92606 82060 50288 38497 49629 87008 31148 77326 78086 67971 46545 76331 62123 96664 ...

result:

ok 

Test #65:

score: 0
Accepted
time: 30ms
memory: 12136kb

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:

1023
75447 58643 36394 76450 37902 53514 63119 86080 78042 70054 64180 54731 28969 33261 8466 75061 42908 23663 77810 76701 33235 69824 44335 41598 46787 23951 23309 2259 61084 73299 45332 55446 89098 87452 5649 10197 81309 48433 41259 37287 70218 72079 8697 37965 79019 23922 10208 81748 15021 41641...

result:

ok 

Test #66:

score: 0
Accepted
time: 36ms
memory: 12556kb

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:

2320
78367 42034 70922 44693 74814 93298 19534 7306 68566 33312 17426 56129 29001 28536 66857 55737 68383 85375 55496 56443 96201 46065 84720 98289 48896 11638 57059 12586 19756 45569 94863 82029 38242 957 85812 44755 1408 78085 95796 71710 85559 7960 92872 96102 66982 70292 36980 58928 97329 50788 ...

result:

ok 

Test #67:

score: 0
Accepted
time: 35ms
memory: 12752kb

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:

1327
81365 89907 2626 58026 86186 81324 57435 72927 40902 47152 18335 13325 50147 60927 5528 5344 34829 51716 50940 26148 28775 11168 92469 27885 89324 64155 8995 37038 59670 22401 35255 64569 92988 42401 57803 66676 62376 15217 72885 3835 66140 52624 3719 60413 90148 67535 16709 15345 58100 91960 6...

result:

ok 

Test #68:

score: 0
Accepted
time: 42ms
memory: 12356kb

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:

62
31942 21125 62711 54590 31876 31298 81763 95735 15822 14729 56025 51885 42349 289 94800 53681 79147 80040 63254 91339 43176 86066 37270 59651 44098 6112 79745 77070 12822 93386 77005 81696 31263 91430 84858 79406 13182 24382 75645 89498 89942 68356 8246 43523 217 38193 35551 48239 40009 38186 903...

result:

ok 

Test #69:

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

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:

1126
60624 94800 11698 55234 40800 15313 95029 66920 15875 36949 1776 8279 68213 45638 33847 38133 5665 23560 834 65830 21555 40498 62203 35499 80873 47189 91581 50132 69463 75959 52407 38886 32501 85800 24309 89295 18806 30108 2370 18813 27630 67115 50693 4857 41875 27145 72233 78214 10735 28602 25...

result:

ok 

Test #70:

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

input:

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

output:

3
2 3 1 
3 1 5 

result:

ok 

Test #71:

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

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:

1086
78425 72880 86508 75224 17179 50473 19641 23452 20522 69111 28772 46707 29925 92480 4300 47163 19987 81165 16287 50042 92739 3306 59475 59850 28892 11756 4417 64773 17433 25882 13084 60380 80757 85775 18633 34790 51198 84411 90290 80332 80588 64571 87819 46115 56394 26901 70760 16802 68465 8493...

result:

ok 

Test #72:

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

input:

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

output:

3
2 1 5 
3 2 1 

result:

ok 

Test #73:

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

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
5 4 7 3 
2 5 4 7 

result:

ok 

Test #74:

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

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:

5
4 1 8 6 7 
1 8 6 7 5 

result:

ok 

Test #75:

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

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:

4
5 8 4 9 
2 5 8 4 

result:

ok 

Test #76:

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

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:

4
5 6 3 4 
10 9 5 6 

result:

ok 

Test #77:

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

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:

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

result:

ok 

Test #78:

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

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:

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

result:

ok