QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#162916#5088. Two Choreographiesntu_vjudge_2AC ✓81ms31444kbC++172.0kb2023-09-03 17:42:482023-09-03 17:42:49

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 5856kb

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

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: 2ms
memory: 5768kb

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:

3
6 5 2
5 2 1

result:

ok 

Test #4:

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

input:

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

output:

7
36 29 19 4 2 16 1
31 34 9 18 15 28 25

result:

ok 

Test #5:

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

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:

27
151 51 167 102 40 154 192 190 23 148 147 141 77 100 21 32 66 43 61 96 16 33 74 58 86 115 19
51 167 102 40 154 192 190 23 148 147 141 77 100 21 32 66 43 61 96 16 33 74 58 86 115 19 46

result:

ok 

Test #6:

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

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:

878
7493 3926 1575 7303 7478 650 7064 7333 4054 7110 3096 4288 7515 7797 7981 4446 3958 6318 983 6409 2256 2983 4164 1626 1243 7740 7011 5080 6056 4065 435 1768 3523 2075 5002 865 3117 4046 1693 5853 2595 7131 2518 4082 1095 5883 5993 5924 7664 1497 3934 5758 6140 7857 3957 7377 7142 2509 4987 5913 ...

result:

ok 

Test #7:

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

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:

11804
97546 63100 80556 4607 68085 94999 75626 70436 41356 5830 40020 74509 88363 37313 64104 42482 23887 89295 76674 86323 24877 46302 52961 75385 85436 10425 20050 11285 81417 94522 85877 39224 72059 91230 56975 22398 80169 15706 96183 91752 91431 28318 58819 80879 97422 45363 81994 69153 74243 31...

result:

ok 

Test #8:

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

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:

11913
53543 70136 25103 56130 85498 56595 74298 54760 88152 95800 87811 88474 11457 72038 83323 43169 15773 71032 38080 43686 91956 88726 64425 38680 13941 2280 90668 3307 57375 77898 84141 92734 88247 48283 26976 44567 36363 83563 95489 94634 59293 54600 98034 98054 56777 62018 58406 59650 78628 32...

result:

ok 

Test #9:

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

input:

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

output:

3
6 1 7 
7 6 5

result:

ok 

Test #10:

score: 0
Accepted
time: 26ms
memory: 31388kb

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

result:

ok 

Test #11:

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

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

result:

ok 

Test #12:

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

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

result:

ok 

Test #13:

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

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

result:

ok 

Test #14:

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

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

result:

ok 

Test #15:

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

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

result:

ok 

Test #16:

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

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

result:

ok 

Test #17:

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

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

result:

ok 

Test #18:

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

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

result:

ok 

Test #19:

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

input:

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

output:

3
6 1 7 
3 2 1

result:

ok 

Test #20:

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

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

result:

ok 

Test #21:

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

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

result:

ok 

Test #22:

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

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

result:

ok 

Test #23:

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

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

result:

ok 

Test #24:

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

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

result:

ok 

Test #25:

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

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

result:

ok 

Test #26:

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

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

result:

ok 

Test #27:

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

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

result:

ok 

Test #28:

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

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

result:

ok 

Test #29:

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

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

result:

ok 

Test #30:

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

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

result:

ok 

Test #31:

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

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

result:

ok 

Test #32:

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

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

result:

ok 

Test #33:

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

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

result:

ok 

Test #34:

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

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

result:

ok 

Test #35:

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

input:

9999
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
52 53
...

output:

3
1 2 9999 
9999 9998 9997

result:

ok 

Test #36:

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

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

result:

ok 

Test #37:

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

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

result:

ok 

Test #38:

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

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

result:

ok 

Test #39:

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

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:

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

result:

ok 

Test #40:

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

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:

5
8 9 10 4 2
2 5 6 7 1

result:

ok 

Test #41:

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

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:

513
863 982 983 73 112 113 114 101 998 997 458 457 67 66 31 32 33 34 402 401 418 665 666 667 668 461 955 956 957 683 684 685 686 687 688 49 50 722 501 217 218 219 220 62 63 694 383 382 381 751 752 643 642 86 85 84 83 510 511 105 71 70 69 68 60 427 426 77 78 958 28 29 369 404 405 136 137 544 545 546 ...

result:

ok 

Test #42:

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

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:

5499
7236 4326 4327 9258 3224 3225 3226 637 636 1284 6047 6046 6045 6044 6043 2484 7227 7228 7007 9086 9085 9084 6938 9183 9182 1068 4005 4006 8140 8139 8257 8258 8259 8260 2643 2644 2645 2646 2132 2133 2134 2135 2136 8045 8044 8043 8042 8041 5035 2535 4341 4340 1983 7055 7054 9753 1101 1100 6867 68...

result:

ok 

Test #43:

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

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:

3240
3351 3352 7730 7729 7728 5874 5875 5876 8167 316 2645 2646 2647 5865 5866 6909 5208 5207 5206 705 706 959 9989 9990 8692 9697 2446 2445 6053 6052 138 2656 2657 2658 1204 1203 1202 1201 1200 2772 2773 2774 347 346 345 344 343 342 341 7420 7421 7797 7796 7795 7794 7793 7792 24 25 26 806 807 808 8...

result:

ok 

Test #44:

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

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:

14488
41036 98471 13052 59865 59866 79781 79782 79783 8778 2598 60917 73558 75889 75888 63017 97505 17744 17743 55310 55309 12134 12133 12132 37804 37803 58411 58412 42643 42642 42641 752 71401 57368 57367 95031 23513 23514 3665 3664 16356 16357 16358 98026 98025 88209 88208 17035 34245 16825 8222 8...

result:

ok 

Test #45:

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

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:

65038
83229 83230 72983 72982 72981 72980 83545 83544 25592 25593 25594 25595 25596 31401 65901 65902 66512 66513 66514 66515 48367 48368 22973 22974 50435 70223 58361 58360 58359 27800 27799 27798 28248 70698 70699 70700 84251 84250 84249 95975 95974 63932 96512 96511 96510 9283 9284 9285 42486 624...

result:

ok 

Test #46:

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

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:

68337
9088 9089 9090 9091 9092 9093 9094 80951 6725 6724 6723 6905 10331 10332 10333 10334 82312 58516 58515 9535 9534 9533 14766 3114 10467 10468 17546 17545 50563 50562 50561 82265 82266 89384 89385 25210 74381 74380 74379 74378 74377 64891 71231 51549 51550 57258 45546 45547 73802 73803 73804 738...

result:

ok 

Test #47:

score: 0
Accepted
time: 66ms
memory: 23168kb

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:

68172
88461 88460 88459 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 47383 47...

result:

ok 

Test #48:

score: 0
Accepted
time: 76ms
memory: 23296kb

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:

67612
29721 50204 94663 94664 94665 81089 30776 30777 23675 90626 90627 90628 1434 49954 49953 79416 79417 76689 76688 86740 35426 35425 24044 24045 85092 88929 77647 77648 77649 99306 99307 99308 22962 80525 58781 58782 8380 8379 85183 22500 22501 9897 9896 9895 40806 40805 39264 39265 39266 39267 ...

result:

ok 

Test #49:

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

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:

61435
90683 90684 90685 90686 90687 90688 90689 90690 41443 90986 90985 81082 32337 35252 35251 47524 22830 22829 59164 59165 59166 59167 88146 88147 88148 88149 75942 75943 24095 63891 63890 46247 75461 75460 75459 75458 75457 75456 75455 75454 75453 75452 89126 39278 39277 12825 64879 64878 70375 ...

result:

ok 

Test #50:

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

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: 81ms
memory: 23136kb

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:

68028
56077 77095 77096 63551 63550 24833 24832 46819 46818 46817 46816 60900 60899 60898 60897 60896 67187 85053 30177 30176 30175 26559 483 484 44568 35629 35630 46326 46327 46328 40520 40519 27099 27100 93553 58447 58446 58445 58444 97685 66953 54468 54467 54466 72789 72788 11597 11596 11595 1513...

result:

ok 

Test #52:

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

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: 2ms
memory: 5784kb

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

result:

ok 

Test #54:

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

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: 2ms
memory: 5860kb

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

result:

ok 

Test #56:

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

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

result:

ok 

Test #57:

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

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: 2ms
memory: 5860kb

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:

4
5 6 3 4
3 4 2 1

result:

ok 

Test #59:

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

input:

4
1 2
4 1
4 3
3 1
4 2

output:

3
4 1 3 
4 2 1

result:

ok 

Test #60:

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

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:

5
6 9 10 8 3
9 10 8 3 1

result:

ok 

Test #61:

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

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:

445
303 934 953 257 106 740 569 996 300 311 644 650 802 363 627 586 393 75 320 42 227 67 79 155 138 689 960 998 147 561 475 872 991 36 853 385 17 827 613 460 116 114 279 794 704 610 329 648 801 362 807 902 605 416 790 611 597 88 484 792 580 306 776 800 564 981 529 374 59 759 618 952 974 672 892 559 ...

result:

ok 

Test #62:

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

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:

4305
378 6121 1985 2270 9471 6936 5598 2740 5927 5485 4869 6296 5306 5545 7859 4836 844 8968 8032 7562 2394 2384 2366 4617 7853 4239 6199 6604 9470 7967 7544 606 3746 5829 5061 4136 2966 2230 5297 3045 8823 5753 9347 9268 7126 1427 1559 6045 966 1133 4700 8859 8068 3092 242 6297 8639 3435 4788 1003 ...

result:

ok 

Test #63:

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

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:

4981
7293 5287 4675 2093 5887 8440 7017 3056 3561 7771 7203 8663 3603 8808 3931 5410 1094 9261 1243 852 5013 1581 2122 4997 7827 5422 1951 4589 2811 935 8637 4876 7093 4923 4172 4645 8343 279 9859 1729 5990 321 1405 678 8830 4073 9117 1833 4727 4156 7632 6181 7139 416 1272 660 4651 3264 2520 5097 23...

result:

ok 

Test #64:

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

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:

57376
69415 66255 45790 33110 93755 89174 87287 71859 11857 57205 48729 5292 44892 74871 82407 22067 40607 74800 32449 61713 95003 53604 99312 67586 97212 55713 16379 44408 86191 27784 76989 35964 95803 48020 42907 47045 49456 18578 21305 19131 11845 50908 45989 68089 59522 30943 82968 94456 51423 3...

result:

ok 

Test #65:

score: 0
Accepted
time: 61ms
memory: 20952kb

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:

54558
8899 9175 45376 41980 48413 29147 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 19169 409 86697 19825 75427 7197 16791 47874 47078 49790 91315 17630 10052 38127 69290 7342 28584 76859 18427...

result:

ok 

Test #66:

score: 0
Accepted
time: 62ms
memory: 21980kb

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:

52868
88349 24058 91392 77896 52772 67623 53406 27374 39869 96945 56504 60387 44176 88585 24307 95888 70218 90495 71319 59752 22450 74835 15594 87424 10950 27074 57132 67796 36018 77297 38428 54678 55439 93876 67168 42391 76737 20690 63382 77307 41234 48310 64883 58369 74454 30776 55966 97613 22726 ...

result:

ok 

Test #67:

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

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:

59405
28802 8040 74346 81671 28920 54665 53298 63227 4992 40392 1119 72424 18284 90630 35957 60315 57418 89510 59085 65394 56955 59292 33374 49196 45589 46771 88479 82884 6436 85939 90918 93347 84651 23237 16501 99422 80383 85325 42734 6340 71442 59215 20065 591 93632 50667 64517 73274 92605 78125 8...

result:

ok 

Test #68:

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

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:

52671
21915 25300 31440 16187 8583 39847 4665 67836 60796 42791 71361 35826 87055 18747 79402 47016 11378 67146 74709 90462 49791 95064 18089 44731 58020 52927 35762 74603 831 8518 53431 50166 84201 89305 70408 76114 72572 23590 19227 28749 24493 40761 93684 921 90933 35599 59363 36113 8876 88637 94...

result:

ok 

Test #69:

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

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:

55833
61796 70081 77762 69695 50312 27036 65122 57904 77187 86746 79531 37251 32617 57002 22951 55701 48041 48599 76855 50823 25974 76030 70625 53982 87618 44811 75064 64562 26874 83130 15846 21189 46760 37410 73132 12425 54489 11344 38345 70054 20024 1167 4997 40694 87250 17874 50111 46028 90759 87...

result:

ok 

Test #70:

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

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: 67ms
memory: 21056kb

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:

51532
13272 84330 82923 4047 67787 78823 4248 41956 83170 77614 38184 11769 58692 46243 48729 77053 8437 60910 91559 20569 82496 80264 72644 29660 49805 32943 25161 44735 6047 37630 63157 38075 70219 76651 83485 80348 15672 50771 50863 2321 33291 79797 81225 29276 73894 24133 62542 89319 91347 8263 ...

result:

ok 

Test #72:

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

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: 2ms
memory: 5892kb

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

result:

ok 

Test #74:

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

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:

4
4 7 5 1
6 7 5 1

result:

ok 

Test #75:

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

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:

5
9 5 8 4 2
7 4 2 3 1

result:

ok 

Test #76:

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

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

result:

ok 

Test #77:

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

input:

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

output:

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

result:

ok 

Test #78:

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

input:

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

output:

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

result:

ok