QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#162594#5088. Two Choreographiesntu_vjudge_1AC ✓58ms19504kbC++171.8kb2023-09-03 14:49:272023-09-03 14:49:27

详细

Test #1:

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

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: 3484kb

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: 3660kb

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

result:

ok 

Test #4:

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

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

result:

ok 

Test #5:

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

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:

4
36 106 11 175
159 123 158 25

result:

ok 

Test #6:

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

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:

34
7616 4680 6218 1559 6715 5622 3870 7823 4555 6146 4978 5508 7339 3268 3601 2794 2088 7957 7581 2214 761 5650 5642 4799 4172 1129 4700 1871 4731 4574 7463 6389 3869 6028
7552 1567 3910 2511 7425 5681 4953 4722 4805 7566 7397 2278 4383 2981 6226 7815 6791 3801 6301 4865 7826 6957 5759 5504 4878 450...

result:

ok 

Test #7:

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

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:

4
98273 91256 32796 54741
91515 65183 14259 63547

result:

ok 

Test #8:

score: 0
Accepted
time: 53ms
memory: 13228kb

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:

3
48423 3475 97816
92343 56227 84361

result:

ok 

Test #9:

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

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:

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

result:

ok 

Test #10:

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

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:

99997
100000 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99952 99951 99950 99949...

result:

ok 

Test #11:

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

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:

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

result:

ok 

Test #12:

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

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:

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

result:

ok 

Test #13:

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

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:

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

result:

ok 

Test #14:

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

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:

995
1000 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 924 923 922...

result:

ok 

Test #15:

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

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:

9998
9999 9997 9996 9995 9994 9993 9992 9991 9990 9989 9988 9987 9986 9985 9984 9983 9982 9981 9980 9979 9978 9977 9976 9975 9974 9973 9972 9971 9970 9969 9968 9967 9966 9965 9964 9963 9962 9961 9960 9959 9958 9957 9956 9955 9954 9953 9952 9951 9950 9949 9948 9947 9946 9945 9944 9943 9942 9941 9940 ...

result:

ok 

Test #16:

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

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:

9999
10000 9998 9997 9996 9995 9994 9993 9992 9991 9990 9989 9988 9987 9986 9985 9984 9983 9982 9981 9980 9979 9978 9977 9976 9975 9974 9973 9972 9971 9970 9969 9968 9967 9966 9965 9964 9963 9962 9961 9960 9959 9958 9957 9956 9955 9954 9953 9952 9951 9950 9949 9948 9947 9946 9945 9944 9943 9942 9941...

result:

ok 

Test #17:

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

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:

94749
94753 94748 94747 94746 94745 94744 94743 94742 94741 94740 94739 94738 94737 94736 94735 94734 94733 94732 94731 94730 94729 94728 94727 94726 94725 94724 94723 94722 94721 94720 94719 94718 94717 94716 94715 94714 94713 94712 94711 94710 94709 94708 94707 94706 94705 94704 94703 94702 94701 ...

result:

ok 

Test #18:

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

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:

99997
99999 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99952 99951 99950 99949 ...

result:

ok 

Test #19:

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

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:

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

result:

ok 

Test #20:

score: 0
Accepted
time: 29ms
memory: 19436kb

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:

99999
100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99952...

result:

ok 

Test #21:

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

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:

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

result:

ok 

Test #22:

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

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:

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

result:

ok 

Test #23:

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

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:

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

result:

ok 

Test #24:

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

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:

999
1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927...

result:

ok 

Test #25:

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

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:

9998
9999 9998 9997 9996 9995 9994 9993 9992 9991 9990 9989 9988 9987 9986 9985 9984 9983 9982 9981 9980 9979 9978 9977 9976 9975 9974 9973 9972 9971 9970 9969 9968 9967 9966 9965 9964 9963 9962 9961 9960 9959 9958 9957 9956 9955 9954 9953 9952 9951 9950 9949 9948 9947 9946 9945 9944 9943 9942 9941 ...

result:

ok 

Test #26:

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

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:

9999
10000 9999 9998 9997 9996 9995 9994 9993 9992 9991 9990 9989 9988 9987 9986 9985 9984 9983 9982 9981 9980 9979 9978 9977 9976 9975 9974 9973 9972 9971 9970 9969 9968 9967 9966 9965 9964 9963 9962 9961 9960 9959 9958 9957 9956 9955 9954 9953 9952 9951 9950 9949 9948 9947 9946 9945 9944 9943 9942...

result:

ok 

Test #27:

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

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:

97064
97065 97064 97063 97062 97061 97060 97059 97058 97057 97056 97055 97054 97053 97052 97051 97050 97049 97048 97047 97046 97045 97044 97043 97042 97041 97040 97039 97038 97037 97036 97035 97034 97033 97032 97031 97030 97029 97028 97027 97026 97025 97024 97023 97022 97021 97020 97019 97018 97017 ...

result:

ok 

Test #28:

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

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:

99998
99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99952 99951 ...

result:

ok 

Test #29:

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

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:

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

result:

ok 

Test #30:

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

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:

99999
100000 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99952 99951...

result:

ok 

Test #31:

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

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:

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

result:

ok 

Test #32:

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

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:

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

result:

ok 

Test #33:

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

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:

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

result:

ok 

Test #34:

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

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:

999
1000 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926...

result:

ok 

Test #35:

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

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:

9998
9999 9997 9996 9995 9994 9993 9992 9991 9990 9989 9988 9987 9986 9985 9984 9983 9982 9981 9980 9979 9978 9977 9976 9975 9974 9973 9972 9971 9970 9969 9968 9967 9966 9965 9964 9963 9962 9961 9960 9959 9958 9957 9956 9955 9954 9953 9952 9951 9950 9949 9948 9947 9946 9945 9944 9943 9942 9941 9940 ...

result:

ok 

Test #36:

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

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:

9999
10000 9998 9997 9996 9995 9994 9993 9992 9991 9990 9989 9988 9987 9986 9985 9984 9983 9982 9981 9980 9979 9978 9977 9976 9975 9974 9973 9972 9971 9970 9969 9968 9967 9966 9965 9964 9963 9962 9961 9960 9959 9958 9957 9956 9955 9954 9953 9952 9951 9950 9949 9948 9947 9946 9945 9944 9943 9942 9941...

result:

ok 

Test #37:

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

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:

92891
92892 92890 92889 92888 92887 92886 92885 92884 92883 92882 92881 92880 92879 92878 92877 92876 92875 92874 92873 92872 92871 92870 92869 92868 92867 92866 92865 92864 92863 92862 92861 92860 92859 92858 92857 92856 92855 92854 92853 92852 92851 92850 92849 92848 92847 92846 92845 92844 92843 ...

result:

ok 

Test #38:

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

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:

99998
99999 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99952 99951 99950 ...

result:

ok 

Test #39:

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

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: 3624kb

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:

3
3 10 4
4 2 5

result:

ok 

Test #41:

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

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:

15
938 223 222 221 512 561 562 563 564 740 741 742 743 475 476
425 424 423 966 965 964 963 390 760 759 908 907 906 744 882

result:

ok 

Test #42:

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

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:

19
8292 8291 1525 1526 1527 1528 7297 7298 1900 335 336 9629 7010 7011 7012 858 857 1822 1823
8461 8462 8463 8464 8465 8466 4411 6998 6999 7000 7371 7372 7777 7778 7779 8213 8340 8341 8460

result:

ok 

Test #43:

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

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:

56
525 526 527 8728 2805 2806 7373 7374 3402 939 940 5364 5365 5066 5067 5068 2207 5205 5204 8718 8717 7152 5610 1148 1149 1582 1583 1584 1585 1586 3483 3482 3481 1540 4831 1891 8101 8102 8103 8079 467 3951 3952 3706 3707 3708 8453 8452 9753 9752 9751 9579 9580 5954 5955 524
2932 2933 9143 9144 8100...

result:

ok 

Test #44:

score: 0
Accepted
time: 46ms
memory: 16988kb

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:

5
48995 48996 48997 48998 67430
86326 86325 86329 86328 86327

result:

ok 

Test #45:

score: 0
Accepted
time: 46ms
memory: 16260kb

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:

71
54736 77496 77497 35294 35295 91885 91886 44465 47112 47113 57189 57190 66477 3867 20904 20905 89124 47052 47053 47054 34018 70252 70251 70250 70249 29555 89707 89708 72256 72257 72258 72259 72260 26077 26076 16200 16201 16202 75763 74208 50084 50083 50082 55493 55494 55495 55496 15614 17064 1706...

result:

ok 

Test #46:

score: 0
Accepted
time: 53ms
memory: 16900kb

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:

204
89386 9279 4338 98975 98974 98973 98972 98971 98970 98969 98968 98967 98966 98965 68390 40049 49238 49237 49236 44921 44920 4891 79472 79473 91931 91932 16962 16961 16960 13520 46684 46685 58545 58544 86228 86227 25851 92322 92321 92320 20759 91720 91719 2012 2011 2010 2009 83468 83469 83470 313...

result:

ok 

Test #47:

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

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:

194
53769 53770 53771 32333 32332 32331 26212 77814 77813 38701 38700 54760 54759 55146 55145 64841 83259 83260 83261 83262 17020 17021 17022 69838 28616 28617 28618 9662 41294 46910 60629 60630 60631 96649 96650 63795 63796 63797 63798 63799 63800 66009 66010 12660 12661 33442 33441 9878 47382 4738...

result:

ok 

Test #48:

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

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:

222
10315 82452 82451 82450 3678 3677 3676 3675 13037 13036 22861 22862 5001 5002 16634 16635 31478 33823 97031 97030 14549 14548 14547 16663 16662 52655 18689 50163 41627 41626 41625 41624 41623 20949 20948 20947 66763 31551 89504 89505 89506 89507 89508 89509 10944 10943 11845 77778 20464 20465 75...

result:

ok 

Test #49:

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

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:

183
1798 1799 1800 15899 15900 19487 50803 50804 50805 92898 92899 91920 91921 14696 16759 14153 14152 83555 6569 6570 6571 6572 6573 6574 6575 63851 63850 63849 46171 46170 46169 75704 65471 84141 57370 57369 57368 57367 57366 18893 18892 18891 18890 18889 73820 73819 84954 84953 84952 32547 32546 ...

result:

ok 

Test #50:

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

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: 47ms
memory: 16612kb

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:

325
51994 51995 51996 51997 51998 51999 52000 52001 46581 46582 46583 46584 97285 97286 81837 22002 12910 12911 28543 98126 98127 54323 54324 80676 68008 34710 34709 34708 67965 67966 67967 67968 67969 51402 51403 51404 32433 40209 40208 40207 44978 44977 44976 44975 44974 27827 49315 49314 49313 96...

result:

ok 

Test #52:

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

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: 3688kb

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

result:

ok 

Test #54:

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

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

result:

ok 

Test #55:

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

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

result:

ok 

Test #56:

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

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:

3
9 8 6
7 8 6

result:

ok 

Test #57:

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

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: 0ms
memory: 3656kb

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: 3660kb

input:

4
1 2
4 1
4 3
3 1
4 2

output:

3
3 4 1
4 2 1

result:

ok 

Test #60:

score: 0
Accepted
time: 1ms
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:

3
5 6 9
6 9 10

result:

ok 

Test #61:

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

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:

23
297 295 837 126 499 684 635 492 612 46 423 969 752 467 884 524 545 679 836 630 542 798 294
472 695 891 204 46 423 969 752 467 884 524 545 679 836 630 542 798 294 859 511 230 563 462

result:

ok 

Test #62:

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

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:

46
5003 8484 2558 1888 358 7512 9399 97 1854 5043 6583 1826 3683 4877 2441 5870 6385 8651 9622 4993 6903 6012 7704 315 449 5857 512 1352 7580 1487 9996 8352 3645 44 1982 4487 9874 9899 7453 3359 4009 2095 7777 6047 4051 4967
6140 1854 5043 6583 1826 3683 4877 2441 5870 6385 8651 9622 4993 6903 6012 ...

result:

ok 

Test #63:

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

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:

60
1790 822 4919 4592 4320 430 1515 6871 8337 2259 2565 778 2165 6230 8842 9132 6618 527 7164 634 2855 6463 7636 6380 8100 2767 2549 8028 2455 493 9903 3890 2079 2407 4612 2788 21 1690 5856 9973 398 9958 435 4415 5200 2019 260 4696 3889 9034 7302 5662 1024 5074 7300 3073 2544 6760 41 4219
88 9174 83...

result:

ok 

Test #64:

score: 0
Accepted
time: 56ms
memory: 16432kb

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:

69
5050 73291 89940 45752 83689 60736 56912 9379 58298 58544 53193 96542 96737 80984 32506 41759 9000 15633 64616 72992 24907 26735 8673 30346 3012 5337 13446 48399 71382 1688 36286 4403 61917 13844 7792 89587 63201 73533 68770 65930 27136 81598 10852 94015 27180 14536 56739 26594 16924 25561 24170 ...

result:

ok 

Test #65:

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

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:

39
46798 14634 54393 55624 11559 26075 82322 84275 71310 86524 2909 26697 47502 23080 49433 8719 51280 89999 82466 73813 16424 41115 561 13771 33239 23071 89118 56979 47889 34273 15004 6174 32826 65850 48908 30292 9595 73176 34050
66954 30515 71906 72689 44289 54284 27148 19842 36179 63543 23169 494...

result:

ok 

Test #66:

score: 0
Accepted
time: 58ms
memory: 16332kb

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:

321
59857 22954 19459 27996 72246 18381 27775 78875 61405 28264 86945 1314 21072 36236 32258 17562 33851 84163 70852 75963 19208 5486 59679 73633 45241 39531 88471 47135 82593 66429 92895 21118 88339 33297 43444 76375 63106 7627 87510 14450 41864 24401 35364 63693 82318 23283 70110 14183 21975 8205 ...

result:

ok 

Test #67:

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

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:

48
94702 30497 64153 43906 98903 72217 41149 17418 54052 22765 93457 97413 41467 37701 27490 23620 28334 17734 20348 42423 55401 19892 8006 71882 1932 54903 3448 31152 92487 44177 26286 79409 34678 56189 43640 58607 70276 7624 76401 50958 93176 93293 68198 7215 49111 72797 7821 92303
26519 4035 8550...

result:

ok 

Test #68:

score: 0
Accepted
time: 50ms
memory: 16416kb

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:

19
36298 69660 12196 88395 37061 37755 51854 1874 77688 13276 49247 17156 7820 59404 97160 4655 28780 91701 20756
91856 30437 85174 33227 41874 51148 33513 79603 37109 62578 49199 12211 20557 74650 59252 58268 29497 60282 17133

result:

ok 

Test #69:

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

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:

50
8983 82910 76679 29777 94759 29682 70168 28698 48287 69017 28627 16223 29136 50528 88905 45520 24271 80947 20711 24681 7307 78968 47960 18017 37970 95638 85557 87633 2434 15886 61828 22306 42046 14067 11878 27752 81361 8590 23917 54650 70630 20695 30620 47001 51305 52776 64263 92837 4014 54466
94...

result:

ok 

Test #70:

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

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: 56ms
memory: 15436kb

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:

118
14448 7712 613 74491 16505 11984 34274 31820 5669 29259 33383 24191 33099 48919 88219 42009 72643 24998 29246 14039 38606 54213 75813 44385 4759 49980 58485 4399 67586 42297 74757 86834 13344 25923 14858 83060 28577 56890 81402 11032 80205 55267 37964 76832 15293 70133 41030 24941 36910 26311 57...

result:

ok 

Test #72:

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

input:

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

output:

3
6 5 3
2 5 3

result:

ok 

Test #73:

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

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

result:

ok 

Test #74:

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

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

result:

ok 

Test #75:

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

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

result:

ok 

Test #76:

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

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:

3
4 5 6
5 6 10

result:

ok 

Test #77:

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

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

result:

ok 

Test #78:

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

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

result:

ok