QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#485263#5088. Two Choreographiesucup-team1005#AC ✓81ms17936kbC++201.5kb2024-07-20 15:38:482024-07-20 15:38:49

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
1 3
1 4
2 3
2 4

output:

3
1 3 2 
2 4 1 

result:

ok 

Test #2:

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

input:

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

output:

4
1 4 3 2 
3 2 5 1 

result:

ok 

Test #3:

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

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

result:

ok 

Test #4:

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

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:

6
2 13 16 19 29 36 
40 16 19 29 36 1 

result:

ok 

Test #5:

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

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
8 113 70 103 156 145 15 127 
119 176 163 153 97 164 6 1 

result:

ok 

Test #6:

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

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:

5
3956 3147 6879 4496 58 
3492 6241 7259 7179 7 

result:

ok 

Test #7:

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

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:

11197
17125 16427 5549 67900 19989 49336 35082 49940 29246 59929 25874 16001 23413 8295 2222 95931 55450 34379 40004 40737 44682 26288 66123 6027 76978 26496 22718 68644 55030 64183 52701 11457 11303 42111 59346 54157 7775 288 88292 64613 4356 33938 37854 10614 40952 80 86558 31248 17695 3699 47086 ...

result:

ok 

Test #8:

score: 0
Accepted
time: 68ms
memory: 12048kb

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:

837
43597 10502 39046 13627 23093 63477 32527 66061 27475 70854 14017 17389 29067 45877 30178 2689 1766 10653 28018 99626 67390 72182 67793 29133 696 29140 49425 44973 41722 22796 59487 12870 41160 55088 77929 61030 47486 74736 50627 72680 47967 23182 92535 52116 83253 21061 19445 34756 59146 29588 ...

result:

ok 

Test #9:

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

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:

4
5 4 3 7 
2 3 7 1 

result:

ok 

Test #10:

score: 0
Accepted
time: 65ms
memory: 17540kb

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:

4
6 5 100000 1 
4 5 100000 1 

result:

ok 

Test #11:

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

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

result:

ok 

Test #12:

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

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:

5
5 4 3 2 9 
4 3 2 9 1 

result:

ok 

Test #13:

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

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

result:

ok 

Test #14:

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

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

result:

ok 

Test #15:

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

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:

4998
5000 4999 4998 4997 4996 4995 4994 4993 4992 4991 4990 4989 4988 4987 4986 4985 4984 4983 4982 4981 4980 4979 4978 4977 4976 4975 4974 4973 4972 4971 4970 4969 4968 4967 4966 4965 4964 4963 4962 4961 4960 4959 4958 4957 4956 4955 4954 4953 4952 4951 4950 4949 4948 4947 4946 4945 4944 4943 4942 ...

result:

ok 

Test #16:

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

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:

4997
4999 4998 4997 4996 4995 4994 4993 4992 4991 4990 4989 4988 4987 4986 4985 4984 4983 4982 4981 4980 4979 4978 4977 4976 4975 4974 4973 4972 4971 4970 4969 4968 4967 4966 4965 4964 4963 4962 4961 4960 4959 4958 4957 4956 4955 4954 4953 4952 4951 4950 4949 4948 4947 4946 4945 4944 4943 4942 4941 ...

result:

ok 

Test #17:

score: 0
Accepted
time: 60ms
memory: 16640kb

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:

4
4 3 94753 1 
2 3 94753 1 

result:

ok 

Test #18:

score: 0
Accepted
time: 67ms
memory: 17936kb

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:

50001
50000 49999 49998 49997 49996 49995 49994 49993 49992 49991 49990 49989 49988 49987 49986 49985 49984 49983 49982 49981 49980 49979 49978 49977 49976 49975 49974 49973 49972 49971 49970 49969 49968 49967 49966 49965 49964 49963 49962 49961 49960 49959 49958 49957 49956 49955 49954 49953 49952 ...

result:

ok 

Test #19:

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

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

result:

ok 

Test #20:

score: 0
Accepted
time: 69ms
memory: 17100kb

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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

result:

ok 

Test #21:

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

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

result:

ok 

Test #22:

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

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

result:

ok 

Test #23:

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

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

result:

ok 

Test #24:

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

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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok 

Test #25:

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

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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

result:

ok 

Test #26:

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

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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

result:

ok 

Test #27:

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

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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

result:

ok 

Test #28:

score: 0
Accepted
time: 64ms
memory: 17104kb

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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

result:

ok 

Test #29:

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

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

result:

ok 

Test #30:

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

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

result:

ok 

Test #31:

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

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

result:

ok 

Test #32:

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

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

result:

ok 

Test #33:

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

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

result:

ok 

Test #34:

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

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

result:

ok 

Test #35:

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

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

result:

ok 

Test #36:

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

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

result:

ok 

Test #37:

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

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

result:

ok 

Test #38:

score: 0
Accepted
time: 63ms
memory: 17148kb

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

result:

ok 

Test #39:

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

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

result:

ok 

Test #40:

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

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

result:

ok 

Test #41:

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

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:

113
223 224 283 284 638 247 246 245 345 346 347 348 543 542 541 540 539 538 537 733 734 523 522 521 22 689 690 691 203 204 205 206 207 208 209 602 601 35 34 468 493 494 495 496 954 955 650 649 444 900 901 720 721 722 501 502 80 81 82 83 715 465 464 3 4 5 6 7 643 644 645 636 637 157 156 155 941 777 7...

result:

ok 

Test #42:

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

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:

581
9666 104 103 2012 905 904 2936 6083 2868 4338 7824 6547 5283 5282 5281 5280 2437 2438 2019 2018 9259 8668 8667 2072 2071 747 746 3266 3265 8941 8942 8943 8944 8945 7468 366 367 7541 7540 7539 7467 7466 4503 4502 9131 113 9075 1459 1458 215 214 213 3294 3295 9568 9567 2771 2772 5465 5466 5467 546...

result:

ok 

Test #43:

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

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:

2057
7059 7058 5252 5251 1403 1404 7586 7587 8195 8196 2239 2240 4004 298 4722 4723 1578 6627 9377 9378 7228 7227 7226 7225 7224 9887 3567 3566 3865 3864 6765 556 7189 7190 7191 5979 5980 1668 910 1717 2995 2994 2993 366 4043 5120 5121 2746 635 634 6676 6677 6678 2004 2005 5051 9903 6242 5106 5105 4...

result:

ok 

Test #44:

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

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:

8894
68867 68868 68869 68870 93027 96249 96250 96251 37377 59452 24136 34235 46678 46677 96457 12884 12883 12882 63490 63489 83143 71179 67807 67806 55772 55771 55770 55769 40321 40322 33693 13369 13368 52903 52902 20290 63237 63238 63239 15289 85786 89124 49593 26921 26920 28152 50289 96723 72340 2...

result:

ok 

Test #45:

score: 0
Accepted
time: 68ms
memory: 15480kb

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:

10183
67673 67674 67675 33886 33887 62614 39157 39158 44323 33247 33246 21733 21732 21731 66170 66171 84887 70548 54458 54457 54456 90734 90733 90732 41597 58406 42398 42397 42396 61636 13917 13918 13919 79876 79877 79878 79879 79880 66898 90894 90895 6997 6998 55180 55181 66160 66161 14916 14917 14...

result:

ok 

Test #46:

score: 0
Accepted
time: 68ms
memory: 15116kb

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:

6601
45050 45049 45048 35785 35784 35783 20819 84154 50327 50326 74652 74651 78584 14472 14473 36176 36175 36174 79385 79386 41106 71454 71455 95387 66150 95073 95074 77703 62262 62261 55528 55527 55526 75316 75317 75318 75319 75320 54926 14088 14087 14086 14085 12794 85668 59281 59282 59283 59284 9...

result:

ok 

Test #47:

score: 0
Accepted
time: 81ms
memory: 15892kb

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:

2945
70453 56583 56582 44517 14020 14021 14022 14023 14024 85930 85931 85932 12035 87700 49236 49237 11500 11501 65650 53169 53168 46872 24067 58074 58073 95330 95331 95332 95333 5401 5402 5403 5404 5405 74382 74381 35796 17067 17066 17065 1561 1560 1559 81388 15517 15518 43995 43996 22560 37206 384...

result:

ok 

Test #48:

score: 0
Accepted
time: 72ms
memory: 15560kb

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:

20289
88582 88583 13995 92369 92370 1397 1396 63850 63849 88072 88071 68555 68556 25543 25544 26582 26581 52773 63548 63547 33539 51664 51663 96036 96037 81442 81441 81440 46207 46208 2955 57025 57026 30663 30662 30661 8496 51701 52549 52548 52547 42618 6205 6206 6207 14185 60539 51953 55932 65458 4...

result:

ok 

Test #49:

score: 0
Accepted
time: 68ms
memory: 15088kb

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:

7099
23025 54946 21107 21108 21109 18075 26626 26145 26146 26147 26148 26149 30695 30694 62730 62729 27799 27800 27801 78445 4700 68043 68042 68559 68558 68557 86932 19079 9659 56903 65207 17292 17293 32640 71711 3369 83279 70405 70404 70403 70402 70401 70400 6397 6398 54509 3653 3652 91158 91159 90...

result:

ok 

Test #50:

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

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:

3
6 2 7 
3 2 7 

result:

ok 

Test #51:

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

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:

22307
7274 7275 51816 57509 38409 38408 32559 36821 36820 34625 34626 34627 14412 14413 45669 45668 19648 19649 14301 14300 81311 81312 90367 90366 23787 23786 23785 91125 91126 91127 91128 91129 91130 53137 53136 53135 46886 53918 53919 78291 69829 85944 85945 30586 30587 30588 91346 91347 34895 34...

result:

ok 

Test #52:

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

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:

3
2 4 5 
3 2 4 

result:

ok 

Test #53:

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

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:

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

result:

ok 

Test #54:

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

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:

3
8 9 1 
6 5 7 

result:

ok 

Test #55:

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

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

result:

ok 

Test #56:

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

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:

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

result:

ok 

Test #57:

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

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:

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

result:

ok 

Test #58:

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

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

result:

ok 

Test #59:

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

input:

4
1 2
4 1
4 3
3 1
4 2

output:

3
1 2 4 
4 3 1 

result:

ok 

Test #60:

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

input:

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

output:

4
10 6 5 9 
8 3 4 10 

result:

ok 

Test #61:

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

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:

15
613 351 567 365 43 187 899 671 570 87 24 868 556 17 827 
513 932 812 629 815 271 181 121 455 74 327 802 363 488 963 

result:

ok 

Test #62:

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

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:

1260
8193 7133 1110 269 7028 395 6480 2988 8577 4898 4656 2513 642 5064 5334 9972 531 2386 5909 3325 9094 2337 6968 2494 2698 8295 2214 9156 7151 1242 2560 9337 5554 7340 252 6892 3652 7703 1524 7010 1000 8562 1084 9329 9311 5787 5730 1581 4849 4323 3647 5480 5489 6001 8262 2379 7287 9001 7031 1286 ...

result:

ok 

Test #63:

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

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:

1648
4647 1034 1792 5313 1596 2038 5675 3217 7167 942 8925 1953 4582 5097 7575 8975 911 49 4321 5727 2814 6477 9243 8391 4653 5365 2434 4291 1671 8843 2549 2201 5224 4675 1369 5411 8694 6367 9119 666 1796 3113 6732 7495 7972 8742 4299 71 9657 1793 1517 1631 655 9914 1094 9261 9916 6197 8371 2521 269...

result:

ok 

Test #64:

score: 0
Accepted
time: 74ms
memory: 14628kb

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:

1169
60745 42757 36704 45541 49843 95645 1100 23367 57514 11542 38706 26050 72493 20851 16302 97741 62602 631 15021 55875 95291 92972 67277 2542 19756 37591 55635 22830 9713 17207 10644 63359 77103 77370 31756 49502 1744 97871 51692 64339 32116 63638 25200 3933 49641 72686 94924 84106 46852 98307 53...

result:

ok 

Test #65:

score: 0
Accepted
time: 64ms
memory: 14348kb

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:

6168
90437 41330 27713 14894 16530 61667 77270 36941 89295 11974 41439 21372 37016 90599 48408 31912 6546 55169 27878 39174 71077 27050 10045 16396 212 21477 40302 52694 75083 3343 57224 41975 27708 61626 64881 14201 56048 87453 47776 2665 31514 23455 84499 21361 21310 17874 77559 38626 70605 30155 ...

result:

ok 

Test #66:

score: 0
Accepted
time: 75ms
memory: 14756kb

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:

1290
71707 72277 96110 60129 16449 15806 8554 80398 83885 68229 92618 7109 72257 45506 81955 65895 24351 15154 4376 5002 23508 26899 6685 5505 92170 27733 78332 1309 60801 97355 48042 69932 8168 75203 766 97379 90621 72732 5246 42157 21203 47966 4289 5266 10817 96491 95126 65247 11319 22707 97629 25...

result:

ok 

Test #67:

score: 0
Accepted
time: 80ms
memory: 15296kb

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:

3818
95666 6425 57401 95235 12005 26828 71262 4061 48442 9226 82017 50492 14742 16713 13384 34421 49474 68279 18676 38164 35497 96897 62761 90804 82876 61422 53430 27155 69502 59404 83737 39238 62066 58565 1995 51822 20749 83322 59881 82595 56941 86204 38193 62742 91982 44961 75406 74624 73713 14701...

result:

ok 

Test #68:

score: 0
Accepted
time: 80ms
memory: 14756kb

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:

51405
98510 87617 48590 2481 8546 80298 22701 30456 39629 68558 57300 37712 11011 8137 5298 27358 12537 19633 37354 35134 626 87657 78196 54580 47652 64772 48931 23791 65294 54691 36924 3966 16045 23764 84485 83672 12718 88941 31567 67345 67010 23326 78094 88975 13210 82778 83323 86356 47388 92505 8...

result:

ok 

Test #69:

score: 0
Accepted
time: 75ms
memory: 14240kb

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:

6044
8573 13631 59960 40414 50342 29454 75063 9877 30654 49773 91250 46883 36423 55854 24856 94714 87183 34872 1300 47835 93801 9210 9129 70926 21627 90636 25416 65121 25730 79514 43718 39499 7664 57127 91240 34455 90709 44953 12723 19963 27554 91990 86459 48898 62915 52147 19593 43993 45207 92489 2...

result:

ok 

Test #70:

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

input:

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

output:

4
5 3 2 1 
4 5 3 2 

result:

ok 

Test #71:

score: 0
Accepted
time: 74ms
memory: 14084kb

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:

13801
25272 31995 82163 57812 58556 26729 11782 50764 87290 23174 41146 72691 74915 22662 11028 85976 46756 31585 61541 54604 73245 71514 59967 16351 6167 64121 87083 74709 35517 88435 2722 79211 880 36876 8529 53803 19970 7759 56073 50200 70569 13498 1018 56210 36856 13562 26447 15002 8070 2988 717...

result:

ok 

Test #72:

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

input:

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

output:

3
3 2 1 
5 6 3 

result:

ok 

Test #73:

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

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:

3
6 3 1 
4 7 5 

result:

ok 

Test #74:

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

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

result:

ok 

Test #75:

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

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

result:

ok 

Test #76:

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

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

result:

ok 

Test #77:

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

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:

3
2 4 7 
8 7 5 

result:

ok 

Test #78:

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

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

result:

ok