QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#162609#5088. Two Choreographiesntu_vjudge_2AC ✓52ms46368kbC++172.8kb2023-09-03 15:03:452023-09-03 15:03:46

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
1 3
1 4
2 3
2 4

output:

3
3 2 1
4 2 1

result:

ok 

Test #2:

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

input:

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

output:

3
3 2 1
5 2 1

result:

ok 

Test #3:

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

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

result:

ok 

Test #4:

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

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
4 2 16 1
13 4 2 16

result:

ok 

Test #5:

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

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:

16
158 25 35 163 176 119 109 48 50 82 95 97 153 31 34 39
164 6 27 73 158 25 35 163 176 119 109 48 50 82 95 97

result:

ok 

Test #6:

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

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:

110
1967 5436 293 1067 49 1873 2505 997 5138 1558 2978 3143 2760 2118 1004 2114 4559 524 2479 2963 1990 1455 1644 2148 396 1134 5383 557 3302 986 1875 1900 4697 1055 822 245 348 1264 3083 3449 2653 4430 1772 6089 2637 5394 871 1002 335 5258 521 1149 3605 5951 984 2328 3738 3688 539 713 461 4233 209 ...

result:

ok 

Test #7:

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

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:

472
15118 11478 61678 33467 38027 5104 8918 9428 4610 20759 46945 50796 3246 41970 3025 41042 3261 57799 35078 28756 24841 19566 19997 1946 8072 56757 15817 26556 10610 17735 24780 11961 99211 26319 35581 25888 81579 49523 50704 90032 43313 69536 26429 1693 64917 8737 13175 63526 47017 7049 8731 146...

result:

ok 

Test #8:

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

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:

1165
63500 4304 23188 21746 83928 12397 15223 33344 4391 23476 12399 17224 39983 357 2387 91759 45792 64636 12719 50491 81210 21625 14143 19154 3080 81611 32442 33153 36657 14836 2812 67623 6017 43303 65078 34138 79009 42634 5096 65928 45332 11463 6742 70849 67930 51540 62864 92010 97187 24475 93498...

result:

ok 

Test #9:

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

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

result:

ok 

Test #10:

score: 0
Accepted
time: 52ms
memory: 45116kb

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
3 2 1
100000 99999 1

result:

ok 

Test #11:

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

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

result:

ok 

Test #12:

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

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

result:

ok 

Test #13:

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

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
10 9 8
10 9 1

result:

ok 

Test #14:

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

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
3 2 1
1000 999 1

result:

ok 

Test #15:

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

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
9999 9998 9997
9999 9998 1

result:

ok 

Test #16:

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

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
10000 9999 9998
10000 9999 1

result:

ok 

Test #17:

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

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
3 2 1
94753 94752 1

result:

ok 

Test #18:

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

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

result:

ok 

Test #19:

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

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

result:

ok 

Test #20:

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

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
3 2 1
100000 99999 1

result:

ok 

Test #21:

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

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

result:

ok 

Test #22:

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

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

result:

ok 

Test #23:

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

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

result:

ok 

Test #24:

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

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
3 2 1
1000 999 1

result:

ok 

Test #25:

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

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
3 2 1
9999 9998 1

result:

ok 

Test #26:

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

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
3 2 1
10000 9999 1

result:

ok 

Test #27:

score: 0
Accepted
time: 52ms
memory: 45380kb

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
3 2 1
97065 97064 1

result:

ok 

Test #28:

score: 0
Accepted
time: 51ms
memory: 46368kb

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
3 2 1
99999 99998 1

result:

ok 

Test #29:

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

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

result:

ok 

Test #30:

score: 0
Accepted
time: 52ms
memory: 43648kb

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
100000 99999 99998
1 100000 2

result:

ok 

Test #31:

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

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

result:

ok 

Test #32:

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

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

result:

ok 

Test #33:

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

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

result:

ok 

Test #34:

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

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
1000 999 998
1 1000 2

result:

ok 

Test #35:

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

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
9999 9998 9997
1 9999 2

result:

ok 

Test #36:

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

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
10000 9999 9998
1 10000 2

result:

ok 

Test #37:

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

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
92892 92891 92890
1 92892 2

result:

ok 

Test #38:

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

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
99999 99998 99997
1 99999 2

result:

ok 

Test #39:

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

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

result:

ok 

Test #40:

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

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

result:

ok 

Test #41:

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

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:

18
876 877 731 730 865 866 867 653 652 900 627 626 572 407 538 539 540 456
880 879 878 453 248 247 246 245 244 243 725 635 636 397 967 968 969 881

result:

ok 

Test #42:

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

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:

851
2744 113 114 2214 2213 2212 9505 9504 5785 2777 2778 2779 2780 2781 2334 2335 2336 6606 6607 6608 4122 4121 4120 2287 2288 6061 6062 6063 6064 6065 1741 9771 9772 6393 1253 1254 1255 3201 3202 3203 8022 8021 4728 9982 9981 9980 9979 9978 9977 4667 4668 3587 3586 5077 5076 5400 463 3903 3902 3739...

result:

ok 

Test #43:

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

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:

594
2713 2714 2715 2716 2717 2718 2719 1644 1645 7495 7496 2484 2483 2482 5754 8887 8888 8642 8643 8644 8645 8646 1490 1491 8357 8358 8359 8360 6254 9299 2417 2418 2411 2410 5492 5491 5490 373 9937 2959 2958 3597 3596 2349 2350 9738 9737 5627 6639 7763 7762 7761 7760 1243 1242 9535 6987 6988 3826 38...

result:

ok 

Test #44:

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

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:

1797
47269 7017 7018 7019 58477 58478 58479 58480 58481 72720 72721 72722 45481 40005 40006 40007 40008 40009 40010 40011 49268 49269 53504 84972 84973 86255 86256 86257 78132 78133 75108 75109 53462 53461 88146 63143 63144 63145 71394 71395 18317 18316 91086 91087 85976 56825 56826 56827 22179 9486...

result:

ok 

Test #45:

score: 0
Accepted
time: 38ms
memory: 16656kb

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:

1282
29330 47628 47629 47630 14611 61428 61427 61426 61425 61424 96458 96459 32257 62660 62659 29482 35847 35846 35845 35844 4888 70073 25903 25902 96565 58150 58151 8030 8031 20846 57699 57698 57697 57696 65101 33080 90854 31626 31625 31624 31623 31622 31621 36807 78705 78706 47869 47870 47871 4787...

result:

ok 

Test #46:

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

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:

392
76726 78000 78001 27574 71178 71177 71176 22959 40683 40682 40681 88628 26759 26760 94760 39737 39736 39735 39734 39733 34507 82029 82030 37715 37714 45109 46962 46961 46960 42505 42506 42507 86403 88151 88150 72517 72516 57071 56670 75219 84602 84601 24311 61815 61816 96330 54506 54505 97066 99...

result:

ok 

Test #47:

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

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:

296
23660 23659 23658 23657 63101 22454 22455 22456 22457 22458 84266 84811 35719 35720 97038 97037 57627 87176 26411 26412 73575 73576 96209 96210 96211 90611 90610 98076 98075 58614 58613 58612 58611 88198 88199 83040 40068 40069 40070 13587 13586 13585 56778 36939 23124 57879 57880 57881 57882 71...

result:

ok 

Test #48:

score: 0
Accepted
time: 33ms
memory: 16888kb

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:

1804
97424 88412 150 149 5136 5135 25043 76362 76363 86201 86202 86203 86204 46037 46038 46039 93874 93875 3801 55243 4833 56388 56387 74615 70617 96954 96955 29048 71529 79975 79976 68466 85347 85348 60252 60253 10996 10995 35016 35015 76046 76045 9654 20480 79649 79648 79647 79646 57022 57023 5702...

result:

ok 

Test #49:

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

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:

22
37321 37322 54602 54603 40987 40986 66611 63791 63790 70382 86740 86739 37489 37488 37487 37486 69560 36362 36361 27336 27337 62303
54465 54466 93643 58255 63227 63226 63225 36064 81079 81080 81081 56591 56592 57134 57135 62498 62499 62500 2814 2815 2816 2817

result:

ok 

Test #50:

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

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

result:

ok 

Test #51:

score: 0
Accepted
time: 39ms
memory: 17064kb

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:

5483
52993 52992 44826 44825 54423 36750 36749 4934 4933 4932 54629 54628 67822 67821 67820 67819 67818 67817 67816 84765 84764 39033 994 73737 73736 8690 8689 11686 65004 65003 33561 33562 59176 53406 53407 69725 29684 41255 41254 79383 79382 79381 10434 10433 37994 96199 45076 86614 66599 66598 66...

result:

ok 

Test #52:

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

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

result:

ok 

Test #53:

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

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:

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

result:

ok 

Test #54:

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

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

result:

ok 

Test #55:

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

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
2 3 10 9 4 5 8 1
6 7 2 3 10 9 4 5

result:

ok 

Test #56:

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

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:

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

result:

ok 

Test #57:

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

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

result:

ok 

Test #58:

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

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 9 7
6 3 4

result:

ok 

Test #59:

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

input:

4
1 2
4 1
4 3
3 1
4 2

output:

3
4 2 1
3 4 1

result:

ok 

Test #60:

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

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:

3
5 6 9
6 9 10

result:

ok 

Test #61:

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

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:

92
946 955 525 795 738 820 370 351 214 797 180 69 987 402 653 554 4 258 863 862 356 502 353 477 570 690 112 14 304 793 442 716 818 179 176 785 346 928 360 517 567 248 86 387 937 182 588 669 65 718 760 308 717 926 276 852 595 596 915 637 825 137 907 582 665 830 500 822 9 666 918 828 749 885 168 756 2...

result:

ok 

Test #62:

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

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:

92
8579 5556 8392 6949 1219 483 857 8399 7132 1069 4872 1035 5431 3728 4135 8406 5418 1625 7714 8620 1546 3055 4344 2168 301 2826 3758 240 2488 2870 8331 8033 6729 7422 5453 856 7455 6508 2621 4919 7025 1026 541 8700 4307 1211 9490 3571 4654 3676 162 2229 6587 8198 669 312 490 9327 3839 92 6284 8267...

result:

ok 

Test #63:

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

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:

129
197 1623 8942 5443 1612 5464 5247 1744 8700 6572 960 8568 9942 8993 8056 2035 7386 9814 5379 5660 6432 1057 4184 5078 9625 106 7622 7169 1869 2450 8489 8284 5270 9694 6643 4777 1598 5758 9300 3482 4861 3245 4909 5293 350 4072 2898 6984 8473 4910 7081 2983 6821 3436 2331 4010 9223 6294 746 1725 5...

result:

ok 

Test #64:

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

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:

787
16761 62280 72777 6004 86437 86615 35193 46775 85686 6229 61944 29556 66369 87605 93613 9553 24429 30327 21927 77987 51609 8674 63941 64496 79988 51406 46212 86475 29189 49909 86074 96048 90015 64191 1983 22506 78786 65701 50285 45670 21723 9576 21104 66170 33557 78915 78296 93737 20839 41700 98...

result:

ok 

Test #65:

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

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:

2718
3158 87986 10404 8967 42354 2955 7199 48584 2613 9566 7234 69617 3899 550 5830 44977 83084 48716 95 90905 52265 66970 63190 16160 29365 41687 47042 33893 82208 63115 21354 12750 27289 31035 15616 91121 29496 11697 51319 258 52569 21585 9875 82043 35092 75070 32019 79799 23770 58015 81267 10108 ...

result:

ok 

Test #66:

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

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:

2553
85517 50167 99987 72411 62230 25481 16581 42959 917 55536 18981 3625 1914 36025 98319 37879 35085 70975 45671 83918 14203 77917 95580 95863 92920 65372 94990 55729 70759 81397 46666 46648 77878 10239 76407 21021 60378 78124 16751 19445 56627 99074 88120 27604 81745 50089 4274 24085 22344 47241 ...

result:

ok 

Test #67:

score: 0
Accepted
time: 39ms
memory: 16548kb

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:

424
19979 48290 51176 99295 55634 39159 15670 2281 23765 63436 41021 8093 14613 15035 49841 97826 61892 61776 90857 7051 52299 77908 69918 93268 5674 36020 63198 6297 7570 67725 37177 39155 90987 23320 63999 96356 49398 76635 39887 32890 94484 98812 94946 87625 37534 46238 35378 1199 5809 34758 1716...

result:

ok 

Test #68:

score: 0
Accepted
time: 37ms
memory: 17232kb

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:

1571
82547 26506 72276 69965 40219 44434 51338 10102 24266 76265 12409 77633 27978 82871 19269 28864 4850 51077 15967 81897 5285 39270 78277 83764 99798 42805 49046 55302 86106 46323 33643 90010 15708 85973 27723 17008 33759 72771 7392 18910 6840 76473 13177 13233 43457 97454 2758 62347 95698 658 54...

result:

ok 

Test #69:

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

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:

3250
13735 63059 95251 65014 67555 3004 56692 16329 75643 17241 22478 54247 92577 76070 78507 64256 90484 52189 94919 39132 86329 80440 48785 94206 4434 26782 87840 40120 9907 6187 73873 24988 46661 64587 42508 78988 17895 54216 13697 62056 12287 93772 37173 7923 10944 59767 23799 81115 81391 27288 ...

result:

ok 

Test #70:

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

input:

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

output:

4
4 2 3 5
2 3 5 1

result:

ok 

Test #71:

score: 0
Accepted
time: 37ms
memory: 16196kb

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:

411
9983 436 69076 23454 11388 92990 63741 55077 51739 73572 91970 35183 78760 6530 69430 65149 85316 17962 72076 76403 21587 74841 19641 6495 58905 2697 82465 10802 14947 18182 8404 78877 13554 30360 1609 65814 72071 39650 16075 28696 86685 6330 35893 37490 91983 5063 90146 40440 40155 11384 67551 ...

result:

ok 

Test #72:

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

input:

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

output:

3
2 5 3
5 3 1

result:

ok 

Test #73:

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

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

result:

ok 

Test #74:

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

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

result:

ok 

Test #75:

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

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 2
9 5 8 4

result:

ok 

Test #76:

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

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
4 5 6 10 9 8 3
7 4 5 6 10 9 8

result:

ok 

Test #77:

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

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

result:

ok 

Test #78:

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

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

result:

ok