QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#641181#4925. Adjacent PairsZhaoZiLong30 7ms26740kbC++142.0kb2024-10-14 19:00:532024-10-14 19:00:53

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 3ms
memory: 26528kb

input:

2
5
4 5 2 4 5
2
1 2

output:

3
0

result:

ok 2 lines

Test #2:

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

input:

1
9
1 2 1 2 3 1 2 1 2

output:

6

result:

ok single line: '6'

Test #3:

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

input:

1
7
6 5 4 1 2 6 5

output:

5

result:

ok single line: '5'

Test #4:

score: 20
Accepted
time: 4ms
memory: 26456kb

input:

1
16
4 3 4 3 4 3 4 3 1 4 3 4 1 4 3 4

output:

10

result:

ok single line: '10'

Test #5:

score: 20
Accepted
time: 2ms
memory: 26340kb

input:

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

output:

9
9
9
9
9
9
9
9
10

result:

ok 9 lines

Test #6:

score: 20
Accepted
time: 4ms
memory: 26528kb

input:

5
19
13 5 17 19 4 9 14 7 15 1 8 10 18 3 6 12 2 16 11
20
2 6 19 12 13 16 8 1 11 7 17 14 4 5 10 18 9 3 15 20
20
10 13 6 17 16 9 8 14 1 5 12 19 20 4 15 11 7 3 2 18
20
13 8 18 16 7 17 10 2 15 1 20 4 19 12 3 14 11 9 5 6
20
4 16 1 19 3 2 6 8 20 7 5 9 10 14 15 13 12 18 11 17

output:

17
18
18
18
18

result:

ok 5 lines

Test #7:

score: 20
Accepted
time: 4ms
memory: 26376kb

input:

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

output:

47
48

result:

ok 2 lines

Test #8:

score: 20
Accepted
time: 3ms
memory: 26500kb

input:

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

output:

8
8
8
8
8
8
8
8
8
8

result:

ok 10 lines

Test #9:

score: 20
Accepted
time: 2ms
memory: 26524kb

input:

4
24
8 7 24 21 19 22 12 9 13 11 1 20 3 16 10 6 2 4 15 17 5 14 18 23
25
23 20 1 7 9 22 6 15 25 21 2 14 10 18 11 5 13 4 17 3 24 8 16 19 12
25
17 19 14 8 22 13 10 1 4 20 15 7 25 16 5 23 9 11 12 6 18 24 2 3 21
25
17 2 3 6 13 24 10 25 4 22 1 11 9 14 20 7 15 21 19 16 12 18 8 5 23

output:

22
23
23
23

result:

ok 4 lines

Test #10:

score: 20
Accepted
time: 4ms
memory: 26460kb

input:

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

output:

98

result:

ok single line: '98'

Test #11:

score: 20
Accepted
time: 4ms
memory: 26420kb

input:

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

output:

6
5
7
6
5
5
6
5
5
7

result:

ok 10 lines

Test #12:

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

input:

5
19
15 10 17 1 5 17 6 1 10 18 2 11 16 5 8 5 8 19 12
20
11 10 19 4 17 11 20 16 4 12 17 13 7 16 17 19 10 15 1 18
20
9 20 9 20 9 20 19 9 19 9 2 3 2 3 2 3 2 9 7 9
20
6 14 8 14 19 5 19 5 11 10 19 4 14 1 10 1 10 8 7 8
20
7 18 7 5 13 7 5 8 13 1 8 5 18 7 13 7 6 7 13 6

output:

15
15
12
15
12

result:

ok 5 lines

Test #13:

score: 20
Accepted
time: 6ms
memory: 26396kb

input:

2
49
8 43 31 29 46 29 32 49 32 19 31 12 44 12 9 49 43 49 43 23 8 2 8 2 5 7 13 25 7 25 7 25 4 25 36 28 36 19 40 19 40 19 30 19 47 40 24 31 9
50
15 46 35 30 35 29 27 29 50 43 47 38 40 38 18 27 24 49 7 49 24 44 4 19 30 24 1 25 1 50 7 38 12 15 50 48 1 27 29 21 46 31 46 41 6 41 50 1 50 32

output:

41
43

result:

ok 2 lines

Test #14:

score: 20
Accepted
time: 4ms
memory: 26460kb

input:

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

output:

6
7
6
6
4
6
8
7
7

result:

ok 9 lines

Test #15:

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

input:

4
24
21 15 5 22 13 14 13 21 18 6 18 6 18 4 19 4 19 10 5 9 21 9 12 24
25
8 14 15 14 15 14 18 17 18 17 21 19 25 1 9 1 15 4 15 4 23 13 19 15 19
25
25 20 15 12 20 12 6 23 25 12 8 15 12 7 20 14 6 12 11 25 8 23 6 8 23
25
7 24 21 17 15 16 17 16 9 21 4 24 15 23 20 17 18 23 3 21 3 7 20 18 5

output:

19
18
18
21

result:

ok 4 lines

Test #16:

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

input:

1
100
34 15 81 15 81 15 81 15 81 15 81 88 16 88 16 88 16 67 87 67 87 67 87 67 87 67 6 62 53 83 53 83 53 83 53 83 53 49 69 49 69 49 69 90 59 90 37 94 37 94 37 94 37 6 55 6 55 89 87 89 87 41 73 8 73 8 73 8 73 8 15 68 9 68 35 76 35 76 35 76 35 76 35 76 40 81 40 81 40 81 40 81 40 31 79 31 79 31 79 31

output:

89

result:

ok single line: '89'

Test #17:

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

input:

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

output:

5
5
5
5
5
5
5
5
5
5

result:

ok 10 lines

Test #18:

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

input:

5
19
7 10 7 10 7 10 16 7 10 18 17 18 17 5 18 17 4 14 1
20
3 13 3 13 3 13 15 3 13 17 16 17 16 19 17 16 9 6 8 11
20
8 19 8 19 8 19 2 8 19 15 9 15 9 7 15 9 6 17 18 11
20
11 1 11 1 11 1 16 11 1 3 13 3 13 18 3 13 9 10 2 4
20
5 14 5 14 5 14 3 5 14 13 1 13 1 10 13 1 7 20 2 12

output:

14
15
15
15
15

result:

ok 5 lines

Test #19:

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

input:

2
50
49 10 49 10 49 10 11 49 10 3 19 3 19 46 3 19 9 50 9 50 41 9 50 37 12 37 12 31 37 12 14 18 14 18 29 14 18 27 7 27 7 45 27 7 20 48 4 38 5 2
50
44 19 44 19 44 19 33 44 19 17 3 17 3 34 17 3 6 26 6 26 7 6 26 23 35 23 35 45 23 35 2 13 2 13 48 2 13 8 49 8 49 24 8 49 4 42 9 20 12 36

output:

45
45

result:

ok 2 lines

Test #20:

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

input:

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

output:

5
5
5
5
5
5
5
5
5
5

result:

ok 10 lines

Test #21:

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

input:

4
24
17 11 17 11 17 11 24 17 11 8 16 8 16 15 8 16 14 20 14 20 3 14 20 23
25
14 16 14 16 14 16 20 14 16 6 23 6 23 17 6 23 10 3 10 3 5 10 3 11 18
25
6 13 6 13 6 13 9 6 13 11 23 11 23 25 11 23 2 17 2 17 19 2 17 5 24
25
13 3 13 3 13 3 12 13 3 18 7 18 7 2 18 7 8 25 8 25 16 8 25 1 17

output:

19
20
20
20

result:

ok 4 lines

Test #22:

score: 20
Accepted
time: 3ms
memory: 26452kb

input:

1
99
26 90 26 90 26 90 13 26 90 3 63 3 63 94 3 63 25 5 25 5 21 25 5 29 30 29 30 85 29 30 69 82 69 82 22 69 82 88 97 88 97 42 88 97 62 66 62 66 72 62 66 73 28 73 28 24 73 28 92 47 92 47 80 92 47 51 38 51 38 23 51 38 14 84 14 84 11 14 84 18 43 18 43 55 18 43 19 49 19 49 99 19 49 8 91 34 17 9 70

output:

94

result:

ok single line: '94'

Test #23:

score: 20
Accepted
time: 3ms
memory: 26464kb

input:

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

output:

7
7
8
7
7
8
6
7
6

result:

ok 9 lines

Test #24:

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

input:

5
19
13 2 10 13 6 19 5 14 17 13 18 14 18 14 1 18 14 18 14
20
12 3 13 3 7 10 19 11 16 11 17 9 8 9 8 1 9 8 9 8
20
9 3 14 12 14 10 1 8 4 18 8 16 10 16 10 1 16 10 16 10
20
7 15 19 20 4 10 1 15 18 10 20 9 11 9 11 1 9 11 9 11
20
15 17 3 4 8 2 5 11 8 19 2 12 7 12 7 1 12 7 12 7

output:

15
16
15
16
16

result:

ok 5 lines

Test #25:

score: 20
Accepted
time: 3ms
memory: 24340kb

input:

2
50
37 28 35 42 1 30 21 22 29 34 46 27 22 10 27 22 49 36 37 33 19 46 2 15 47 31 43 31 43 31 43 31 43 31 43 31 43 1 31 43 31 43 31 43 31 43 31 43 31 43
50
23 14 9 13 18 16 35 25 41 43 50 40 50 39 6 39 30 20 49 11 14 7 17 42 4 17 23 17 23 17 23 17 23 17 23 17 23 1 17 23 17 23 17 23 17 23 17 23 17 23

output:

42
41

result:

ok 2 lines

Test #26:

score: 20
Accepted
time: 3ms
memory: 26524kb

input:

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

output:

6
7
7
7
6
7
7
6
7
6

result:

ok 10 lines

Test #27:

score: 20
Accepted
time: 2ms
memory: 26380kb

input:

4
25
23 12 23 14 10 19 17 2 25 18 11 7 10 7 10 7 10 7 1 10 7 10 7 10 7
25
6 10 3 22 18 23 11 2 8 10 15 3 14 10 14 10 14 10 1 14 10 14 10 14 10
25
7 13 3 16 14 6 4 16 21 8 5 20 17 1 17 1 17 1 2 17 1 17 1 17 1
25
11 8 3 8 21 20 1 2 17 15 17 3 7 21 7 21 7 21 1 7 21 7 21 7 21

output:

19
19
20
19

result:

ok 4 lines

Test #28:

score: 20
Accepted
time: 4ms
memory: 24348kb

input:

1
99
87 35 81 77 78 24 83 46 65 1 27 46 40 91 90 47 43 52 15 73 22 92 99 11 10 76 65 39 20 93 44 57 87 71 96 33 1 40 30 64 61 60 33 31 43 62 78 59 68 90 81 78 81 78 81 78 81 78 81 78 81 78 81 78 81 78 81 78 81 78 81 78 81 78 1 81 78 81 78 81 78 81 78 81 78 81 78 81 78 81 78 81 78 81 78 81 78 81 78

output:

83

result:

ok single line: '83'

Test #29:

score: 20
Accepted
time: 4ms
memory: 26368kb

input:

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

output:

5
6
2
2
2
5
7
2
3
1

result:

ok 10 lines

Test #30:

score: 20
Accepted
time: 3ms
memory: 26372kb

input:

5
20
19 20 4 20 4 20 4 20 8 20 8 20 4 8 20 4 20 8 20 8
20
10 14 6 14 6 14 6 4 14 6 14 6 14 6 4 14 6 14 6 14
20
17 12 2 12 2 12 2 12 2 12 2 12 2 12 2 12 2 18 12 18
20
6 4 2 20 4 2 4 2 4 2 20 4 20 4 20 4 2 4 2 20
20
7 14 20 14 20 14 20 14 20 14 20 14 16 14 20 14 20 14 20 16

output:

11
12
4
13
3

result:

ok 5 lines

Test #31:

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

input:

2
49
30 13 26 13 26 13 26 13 26 13 26 23 13 26 23 13 26 13 26 13 26 13 26 13 26 13 26 13 26 13 26 13 26 23 13 26 13 26 13 26 13 26 13 26 23 13 26 13 23
50
36 21 9 21 9 21 48 21 9 21 9 21 9 21 48 21 9 21 9 21 9 48 21 9 21 9 21 9 21 9 21 9 21 9 48 21 9 21 9 21 9 21 9 48 21 48 21 9 21 9

output:

24
32

result:

ok 2 lines

Test #32:

score: 20
Accepted
time: 2ms
memory: 26472kb

input:

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

output:

4
6
4
3
5
3
6
7
1

result:

ok 9 lines

Test #33:

score: 20
Accepted
time: 2ms
memory: 24344kb

input:

4
24
21 17 10 7 17 10 17 10 17 10 17 10 17 10 17 10 17 10 17 10 17 10 7 17
25
13 12 19 12 19 12 19 12 19 16 12 19 12 19 12 19 16 12 19 16 12 19 12 19 16
25
18 21 24 21 24 21 24 23 21 24 21 24 21 24 21 24 21 24 21 24 23 21 24 23 21
25
13 2 6 2 6 2 6 2 16 2 6 2 6 2 6 2 6 2 6 2 6 2 16 2 16

output:

7
19
16
4

result:

ok 4 lines

Test #34:

score: 20
Accepted
time: 2ms
memory: 26396kb

input:

1
100
46 97 37 97 37 97 37 97 37 97 37 97 37 97 37 97 37 97 37 97 37 97 38 97 37 97 37 97 37 97 37 97 37 38 97 37 97 37 97 37 97 37 97 37 97 37 97 37 97 37 97 38 97 37 97 37 97 37 97 37 97 38 97 37 97 37 97 37 97 37 97 37 97 37 97 37 97 37 97 37 38 97 37 97 37 38 97 37 97 37 97 37 97 37 97 38 97 37 ...

output:

60

result:

ok single line: '60'

Test #35:

score: 20
Accepted
time: 4ms
memory: 26444kb

input:

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

output:

6
7
7
5
7
3
7
5
6

result:

ok 9 lines

Test #36:

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

input:

5
19
3 10 9 15 12 17 7 3 15 1 3 10 9 15 12 17 7 3 15
20
11 14 13 3 16 18 15 4 19 8 1 11 14 13 3 16 18 15 4 19
20
7 6 7 11 12 7 17 6 4 18 1 7 6 7 11 12 7 17 6 4
20
19 5 19 18 4 3 13 1 11 4 1 19 5 19 18 4 3 13 1 11
20
6 20 5 8 3 8 20 13 6 12 1 6 20 5 8 3 8 20 13 6

output:

15
18
16
16
16

result:

ok 5 lines

Test #37:

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

input:

2
49
40 39 41 17 42 30 37 24 23 43 25 18 1 40 8 29 28 5 39 44 48 12 48 37 1 40 39 41 17 42 30 37 24 23 43 25 18 1 40 8 29 28 5 39 44 48 12 48 37
50
41 27 22 34 42 11 25 30 33 31 6 34 37 40 46 15 19 36 8 4 23 39 42 14 31 1 41 27 22 34 42 11 25 30 33 31 6 34 37 40 46 15 19 36 8 4 23 39 42 14

output:

45
42

result:

ok 2 lines

Test #38:

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

input:

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

output:

6
4
6
5
5
5
6
6
3
6

result:

ok 10 lines

Test #39:

score: 20
Accepted
time: 2ms
memory: 26444kb

input:

4
24
3 8 2 22 17 4 5 1 18 8 1 10 1 3 8 2 22 17 4 5 1 18 8 1
25
11 12 3 20 5 20 4 9 3 15 21 20 1 11 12 3 20 5 20 4 9 3 15 21 20
25
14 13 21 12 18 25 15 18 10 19 6 25 1 14 13 21 12 18 25 15 18 10 19 6 25
25
15 20 22 3 18 13 3 24 25 16 23 20 1 15 20 22 3 18 13 3 24 25 16 23 20

output:

20
21
22
21

result:

ok 4 lines

Test #40:

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

input:

1
100
22 35 21 19 100 1 31 65 67 3 92 84 29 7 67 44 22 56 81 94 6 17 52 84 38 51 86 29 93 35 48 3 77 29 53 11 27 16 30 27 75 59 67 48 79 55 92 47 78 64 1 22 35 21 19 100 1 31 65 67 3 92 84 29 7 67 44 22 56 81 94 6 17 52 84 38 51 86 29 93 35 48 3 77 29 53 11 27 16 30 27 75 59 67 48 79 55 92 47 78

output:

94

result:

ok single line: '94'

Test #41:

score: 20
Accepted
time: 3ms
memory: 26460kb

input:

47
2
1 2
2
2 1
2
1 2
2
2 1
2
2 1
2
2 1
2
1 2
2
1 2
2
1 2
2
2 1
2
2 1
2
1 2
2
2 1
2
2 1
2
1 2
2
1 2
2
1 2
2
1 2
2
2 1
2
1 2
2
2 1
2
1 2
2
2 1
2
2 1
2
1 2
2
1 2
2
1 2
2
1 2
2
2 1
2
2 1
2
2 1
2
1 2
2
1 2
2
1 2
2
2 1
2
1 2
2
2 1
2
1 2
2
2 1
2
2 1
2
1 2
3
2 1 2
3
1 3 2
3
3 2 1
3
2 3 2
3
1 3 1
3
2 3 1

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1

result:

ok 47 lines

Test #42:

score: 20
Accepted
time: 3ms
memory: 24356kb

input:

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

output:

5
6
7
7
6
7
7
5
6
7

result:

ok 10 lines

Test #43:

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

input:

5
20
7 5 20 8 3 1 5 1 9 6 17 18 4 1 13 12 18 13 5 12
20
17 11 18 16 19 7 12 20 11 4 12 20 18 15 7 1 3 4 13 5
20
3 14 9 8 20 1 18 19 8 12 8 2 17 20 7 11 18 10 15 11
20
20 10 13 11 12 20 8 3 18 14 6 20 16 7 16 20 15 20 5 6
20
3 15 4 10 19 12 1 3 8 3 7 9 4 18 2 6 17 5 18 14

output:

15
16
16
14
16

result:

ok 5 lines

Test #44:

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

input:

2
49
2 28 46 41 17 13 1 37 14 22 30 7 46 16 25 47 41 10 46 42 13 7 12 16 29 44 22 37 26 18 36 22 49 25 49 20 45 35 10 4 31 5 4 46 13 27 7 44 16
50
1 6 36 18 43 18 12 2 37 6 25 18 25 6 37 47 2 36 39 24 9 13 7 37 28 29 3 38 11 3 1 42 20 37 10 46 2 29 46 39 33 7 13 23 6 15 31 38 33 9

output:

44
45

result:

ok 2 lines

Test #45:

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

input:

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

output:

7
7
6
7
8
6
8
7
8

result:

ok 9 lines

Test #46:

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

input:

4
24
14 9 10 6 17 4 15 20 5 3 9 3 4 12 16 24 2 12 9 8 7 15 4 20
25
17 23 17 10 16 11 6 20 8 11 14 20 18 23 6 16 10 24 8 18 13 18 10 9 25
25
22 18 15 17 13 10 20 10 13 14 6 21 22 24 14 10 24 11 15 2 24 10 20 8 6
25
4 25 3 24 5 20 14 2 7 6 25 12 25 15 12 14 6 17 2 9 21 15 21 6 5

output:

20
21
19
21

result:

ok 4 lines

Test #47:

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

input:

1
100
60 82 67 52 80 4 67 13 57 75 99 22 82 88 30 22 14 8 100 98 95 81 52 83 43 87 59 37 48 64 35 21 90 93 74 53 92 97 63 18 16 68 62 73 56 49 89 41 27 55 73 65 97 75 17 16 78 94 93 77 20 85 98 16 88 24 84 20 93 44 2 24 29 66 48 88 65 77 14 80 20 17 90 8 33 64 10 2 98 50 29 28 44 87 74 50 20 25 72 75

output:

94

result:

ok single line: '94'

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #48:

score: 10
Accepted
time: 3ms
memory: 26376kb

input:

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

output:

8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9

result:

ok 48 lines

Test #49:

score: 10
Accepted
time: 0ms
memory: 26528kb

input:

24
20
12 13 18 15 19 3 8 14 20 2 7 9 1 5 16 17 11 10 4 6
20
10 14 2 11 17 20 8 13 19 6 7 15 5 16 12 1 3 18 9 4
20
13 6 1 10 19 8 12 16 3 11 17 15 4 18 2 5 14 7 9 20
20
6 2 18 17 13 12 9 5 20 19 11 7 15 16 14 10 1 3 4 8
20
13 11 19 10 15 14 4 1 18 3 20 12 9 16 17 5 6 8 2 7
20
19 20 9 17 7 3 18 1 13 1...

output:

18
18
18
18
18
18
18
18
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19

result:

ok 24 lines

Test #50:

score: 10
Accepted
time: 0ms
memory: 26316kb

input:

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

output:

53
53
53
53
53
53
54
54
54

result:

ok 9 lines

Test #51:

score: 10
Accepted
time: 0ms
memory: 26532kb

input:

22
22
9 18 20 5 19 21 13 11 8 16 15 3 1 10 22 14 17 12 2 4 7 6
22
20 3 22 15 8 12 13 5 7 16 17 2 9 14 21 18 6 19 4 10 1 11
22
15 4 19 16 13 17 5 10 12 11 8 20 1 7 14 9 21 2 18 6 3 22
22
5 7 22 4 15 8 9 6 2 10 20 21 17 14 19 18 12 13 16 11 1 3
22
21 16 4 18 15 5 17 14 13 22 12 8 20 19 3 2 9 10 11 6 1...

output:

20
20
20
20
20
20
20
20
20
20
21
21
21
21
21
21
21
21
21
21
21
21

result:

ok 22 lines

Test #52:

score: 10
Accepted
time: 0ms
memory: 26460kb

input:

4
125
92 50 77 114 83 35 52 107 79 57 117 75 58 111 99 81 6 42 25 26 53 73 30 1 98 49 89 121 27 65 116 5 3 66 88 123 101 120 110 108 76 106 22 85 63 119 10 8 104 94 70 21 90 16 23 33 125 36 96 67 69 15 32 68 51 112 118 102 64 54 2 19 20 109 43 17 14 82 7 91 95 55 37 11 47 93 31 34 46 78 39 74 13 71 ...

output:

123
123
123
123

result:

ok 4 lines

Test #53:

score: 10
Accepted
time: 4ms
memory: 24476kb

input:

1
500
485 346 384 234 289 165 24 368 198 22 401 338 404 488 81 437 60 186 459 104 287 407 55 380 473 321 184 82 315 357 76 215 116 364 396 237 268 441 415 196 310 59 176 53 223 224 134 143 333 182 390 66 273 151 288 395 468 344 434 285 242 385 49 430 175 327 114 336 46 102 461 113 325 163 119 456 32...

output:

498

result:

ok single line: '498'

Test #54:

score: 10
Accepted
time: 4ms
memory: 26392kb

input:

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

output:

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

result:

ok 50 lines

Test #55:

score: 10
Accepted
time: 2ms
memory: 26456kb

input:

24
20
20 17 2 16 18 12 3 2 15 5 1 8 2 19 18 8 3 16 1 14
20
11 8 2 9 8 2 20 3 9 14 19 9 2 18 11 8 14 8 18 3
20
3 20 10 12 5 7 5 12 4 12 7 4 8 11 8 2 7 11 8 11
20
7 4 8 15 8 15 4 3 4 5 19 5 19 7 17 3 17 8 12 3
20
4 12 17 15 4 15 4 15 5 12 5 4 5 17 12 4 15 4 15 17
20
19 20 12 16 11 15 19 13 11 17 12 7 ...

output:

16
15
14
15
14
17
14
10
15
14
17
16
15
15
11
15
14
15
12
12
14
15
12
16

result:

ok 24 lines

Test #56:

score: 10
Accepted
time: 0ms
memory: 26448kb

input:

10
49
34 9 24 9 24 9 2 16 2 16 2 48 11 36 11 29 28 29 28 29 10 33 10 29 41 29 41 44 18 44 18 46 36 16 36 34 26 29 44 39 5 18 34 1 34 47 3 18 1
50
33 27 20 39 29 1 39 45 1 23 14 21 23 35 22 13 41 13 20 14 22 47 50 22 25 37 27 22 20 47 20 29 36 20 14 28 8 47 22 30 44 36 43 25 50 10 36 43 25 11
50
23 3...

output:

40
43
41
39
44
44
39
38
45
41

result:

ok 10 lines

Test #57:

score: 10
Accepted
time: 0ms
memory: 26444kb

input:

21
23
16 10 20 17 11 15 12 20 12 20 11 20 11 15 1 15 17 16 10 12 16 17 15
23
22 18 19 18 6 19 6 20 5 17 15 17 1 8 1 15 16 10 23 20 5 16 11
23
18 8 3 20 6 20 4 1 14 3 19 23 7 13 5 6 3 17 8 19 18 1 13
23
8 15 22 15 22 7 9 7 9 17 7 17 23 8 23 8 10 2 18 7 18 7 8
23
3 11 6 5 13 12 4 12 11 2 16 3 7 1 6 14...

output:

17
19
19
17
18
13
16
14
16
18
20
15
20
17
19
19
18
18
17
17
20

result:

ok 21 lines

Test #58:

score: 10
Accepted
time: 0ms
memory: 26448kb

input:

4
124
98 26 30 26 30 40 30 7 108 7 108 40 59 40 51 123 106 123 106 123 106 7 26 7 26 82 26 51 95 51 26 59 26 98 51 98 123 26 106 98 106 98 26 30 26 30 26 80 26 80 26 13 110 13 110 13 123 51 40 26 40 26 40 26 80 26 80 59 80 59 80 59 13 98 13 98 13 98 74 106 82 106 82 80 108 80 121 7 26 30 26 30 26 30...

output:

104
109
111
111

result:

ok 4 lines

Test #59:

score: 10
Accepted
time: 3ms
memory: 26436kb

input:

1
496
4 371 455 3 430 3 430 3 430 3 430 3 430 3 430 3 430 3 430 3 430 326 162 326 162 326 162 326 162 326 162 326 32 487 32 487 32 487 32 487 32 487 32 487 32 487 32 487 32 487 32 487 32 160 163 160 163 160 163 319 131 319 131 319 131 319 131 319 131 319 131 319 45 386 45 386 45 386 45 386 45 386 45...

output:

464

result:

ok single line: '464'

Test #60:

score: 10
Accepted
time: 2ms
memory: 26400kb

input:

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

output:

5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
6
6
6
6
6
6

result:

ok 49 lines

Test #61:

score: 10
Accepted
time: 0ms
memory: 24408kb

input:

25
19
17 16 17 16 17 16 18 17 16 15 12 15 12 14 15 12 8 7 13
19
15 9 15 9 15 9 3 15 9 4 2 4 2 18 4 2 10 16 5
19
3 18 3 18 3 18 8 3 18 10 15 10 15 7 10 15 1 16 13
19
4 6 4 6 4 6 18 4 6 7 16 7 16 9 7 16 15 14 8
20
15 20 15 20 15 20 10 15 20 16 17 16 17 5 16 17 2 18 6 12
20
7 18 7 18 7 18 6 7 18 4 8 4 ...

output:

14
14
14
14
15
15
15
15
15
15
15
15
15
15
15
15
15
15
15
15
15
15
15
15
15

result:

ok 25 lines

Test #62:

score: 10
Accepted
time: 0ms
memory: 26464kb

input:

9
55
10 45 10 45 10 45 36 10 45 40 6 40 6 13 40 6 29 12 29 12 47 29 12 44 16 44 16 35 44 16 41 27 41 27 32 41 27 37 1 37 1 54 37 1 38 51 38 51 7 38 51 46 19 53 42
55
23 22 23 22 23 22 18 23 22 39 14 39 14 4 39 14 45 26 45 26 6 45 26 52 15 52 15 31 52 15 55 40 55 40 24 55 40 25 27 25 27 46 25 27 50 1...

output:

50
50
50
50
50
51
51
51
51

result:

ok 9 lines

Test #63:

score: 10
Accepted
time: 0ms
memory: 26528kb

input:

21
23
15 3 15 3 15 3 20 15 3 14 12 14 12 11 14 12 16 17 16 17 23 16 17
23
14 2 14 2 14 2 7 14 2 11 19 11 19 4 11 19 16 15 16 15 17 16 15
23
1 17 1 17 1 17 11 1 17 14 15 14 15 12 14 15 19 16 19 16 5 19 16
23
12 8 12 8 12 8 10 12 8 6 21 6 21 14 6 21 16 7 16 7 9 16 7
23
23 17 23 17 23 17 16 23 17 19 13...

output:

18
18
18
18
18
18
18
18
19
19
19
19
19
19
19
19
19
19
19
19
19

result:

ok 21 lines

Test #64:

score: 10
Accepted
time: 4ms
memory: 26456kb

input:

4
123
98 43 98 43 98 43 89 98 43 8 27 8 27 82 8 27 81 69 81 69 118 81 69 88 73 88 73 6 88 73 116 65 116 65 52 116 65 32 102 32 102 96 32 102 101 23 101 23 1 101 23 4 46 4 46 36 4 46 10 26 10 26 72 10 26 35 84 35 84 9 35 84 66 39 66 39 25 66 39 79 90 79 90 28 79 90 99 31 99 31 106 99 31 97 109 97 109...

output:

118
119
119
119

result:

ok 4 lines

Test #65:

score: 10
Accepted
time: 0ms
memory: 26500kb

input:

1
496
466 249 466 249 466 249 331 466 249 382 121 382 121 338 382 121 188 22 188 22 253 188 22 201 11 201 11 429 201 11 181 5 181 5 277 181 5 272 303 272 303 493 272 303 403 375 403 375 196 403 375 16 107 16 107 119 16 107 478 340 478 340 263 478 340 402 144 402 144 252 402 144 231 463 231 463 496 2...

output:

491

result:

ok single line: '491'

Test #66:

score: 10
Accepted
time: 0ms
memory: 26460kb

input:

46
10
1 7 4 8 7 9 3 1 9 3
10
1 9 4 2 5 7 10 1 7 10
10
5 9 10 9 10 5 10 1 5 10
10
3 4 3 2 7 3 1 2 3 1
10
7 9 10 5 8 6 8 1 6 8
10
10 6 9 3 7 1 7 2 1 7
10
3 2 3 10 5 6 4 1 6 4
11
2 10 9 11 6 4 2 5 1 2 5
11
2 5 10 4 5 11 6 1 2 6 1
11
4 9 11 10 5 1 11 10 1 11 10
11
5 8 6 9 11 7 2 11 1 2 11
11
8 4 3 5 8 1...

output:

8
8
5
5
7
7
7
8
8
8
8
8
8
8
8
7
8
8
7
8
8
8
8
8
8
8
8
7
8
9
8
7
7
8
8
7
8
8
9
7
8
7
7
8
8
9

result:

ok 46 lines

Test #67:

score: 10
Accepted
time: 0ms
memory: 26368kb

input:

24
20
20 9 12 7 15 20 10 1 2 5 12 13 12 13 12 1 13 12 13 12
20
20 6 3 1 5 8 2 19 13 16 19 8 18 8 18 1 8 18 8 18
20
19 1 15 2 16 7 2 12 9 18 4 15 17 15 17 1 15 17 15 17
20
7 12 20 1 9 20 12 9 18 5 16 4 1 4 1 2 4 1 4 1
21
21 12 10 2 9 10 11 10 2 11 20 13 2 1 2 1 3 2 1 2 1
21
17 20 18 9 11 14 5 15 11 1...

output:

14
16
15
16
17
16
17
17
16
17
17
17
17
15
17
17
17
17
17
18
17
17
16
15

result:

ok 24 lines

Test #68:

score: 10
Accepted
time: 0ms
memory: 26472kb

input:

10
49
41 22 48 29 27 41 43 36 23 11 16 23 13 43 17 45 11 41 49 20 12 14 5 43 1 12 1 12 1 12 1 12 1 12 1 12 2 1 12 1 12 1 12 1 12 1 12 1 12
49
21 24 9 47 30 25 1 22 23 10 21 44 1 8 33 2 24 5 22 40 20 4 26 41 5 36 5 36 5 36 5 36 5 36 5 36 1 5 36 5 36 5 36 5 36 5 36 5 36
49
46 41 30 8 47 26 29 40 28 29...

output:

40
39
39
41
42
40
40
41
43
41

result:

ok 10 lines

Test #69:

score: 10
Accepted
time: 2ms
memory: 26376kb

input:

20
24
7 16 20 14 13 14 1 17 2 3 11 13 12 13 12 13 12 1 13 12 13 12 13 12
24
24 1 22 6 14 23 1 18 20 18 3 9 4 9 4 9 4 1 9 4 9 4 9 4
25
9 24 13 23 16 6 5 11 18 22 7 6 4 16 4 16 4 16 1 4 16 4 16 4 16
25
15 5 6 9 11 16 6 2 12 11 21 18 1 7 1 7 1 7 2 1 7 1 7 1 7
25
12 20 23 1 12 14 2 14 6 24 22 7 15 1 15 ...

output:

18
19
19
20
19
20
19
19
19
19
20
19
17
20
20
19
20
21
19
20

result:

ok 20 lines

Test #70:

score: 10
Accepted
time: 2ms
memory: 26464kb

input:

4
124
67 44 82 108 18 79 124 18 118 85 68 80 43 42 52 15 97 46 123 93 9 92 38 89 64 16 75 39 62 43 26 62 9 121 2 52 84 116 35 122 14 1 21 76 100 99 30 58 116 67 49 47 17 11 4 49 112 76 57 56 79 68 70 121 44 121 44 121 44 121 44 121 44 121 44 121 44 121 44 121 44 121 44 121 44 121 44 121 44 121 44 12...

output:

106
107
106
108

result:

ok 4 lines

Test #71:

score: 10
Accepted
time: 2ms
memory: 26556kb

input:

1
498
104 289 280 232 207 204 107 209 281 159 190 398 264 156 295 34 87 231 274 295 93 397 462 27 84 374 149 262 126 324 224 342 212 170 458 166 21 253 66 363 402 276 5 463 452 399 108 30 81 74 349 354 155 173 428 379 160 153 51 141 100 115 40 361 179 304 52 25 112 150 42 414 207 209 428 34 475 24 6...

output:

433

result:

ok single line: '433'

Test #72:

score: 10
Accepted
time: 2ms
memory: 26436kb

input:

47
10
2 9 8 9 8 9 5 9 8 5
10
2 9 8 9 8 9 8 9 5 9
10
7 5 10 5 10 9 5 9 5 9
10
7 10 8 10 8 10 8 10 8 9
10
6 5 7 5 7 5 7 5 7 3
10
7 3 4 3 4 3 4 3 4 2
10
3 9 6 9 6 9 6 9 6 9
10
2 8 9 3 8 9 3 8 9 8
10
9 8 5 8 5 8 5 8 10 8
10
2 7 3 7 3 7 3 7 3 7
10
6 2 5 2 5 2 5 4 2 5
10
2 7 8 7 8 7 8 7 8 9
10
3 9 2 9 5 9...

output:

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

result:

ok 47 lines

Test #73:

score: 10
Accepted
time: 4ms
memory: 26444kb

input:

24
20
9 12 10 12 10 12 10 12 10 12 10 12 10 12 10 12 10 1 12 10
20
9 4 20 4 20 4 20 4 20 4 20 4 18 4 20 4 20 4 20 18
20
17 20 4 10 20 4 20 4 20 4 20 4 20 4 20 10 20 4 20 4
20
7 20 18 20 18 20 18 20 18 20 18 20 18 20 18 10 20 18 10 20
20
1 8 3 8 3 8 3 12 8 3 8 3 8 12 8 3 8 3 12 8
20
12 6 13 6 9 6 9 6...

output:

5
3
6
6
14
4
3
2
12
15
9
5
2
2
10
3
3
6
10
7
2
2
14
15

result:

ok 24 lines

Test #74:

score: 10
Accepted
time: 5ms
memory: 26456kb

input:

9
55
39 51 35 51 35 51 35 51 35 51 35 51 3 51 3 51 35 51 35 51 35 51 35 51 35 51 35 51 35 51 3 51 35 51 35 51 35 51 35 51 35 51 35 51 35 51 35 51 3 51 35 51 35 51 3
55
44 2 40 2 40 2 40 2 28 2 40 2 40 2 40 28 2 40 2 40 2 40 2 40 2 40 2 40 2 40 2 40 2 28 2 40 2 28 2 40 2 40 2 40 2 40 2 28 2 40 2 28 2...

output:

6
26
36
31
8
37
36
8
16

result:

ok 9 lines

Test #75:

score: 10
Accepted
time: 0ms
memory: 26340kb

input:

20
24
2 8 14 8 14 8 14 8 14 8 14 8 1 8 14 1 8 14 8 1 8 14 8 1
25
1 8 5 8 5 8 5 8 5 8 5 8 5 8 5 8 5 19 8 5 8 5 8 19 8
25
7 25 17 25 17 25 17 25 17 25 17 25 17 25 17 25 6 25 17 6 25 17 25 17 6
25
13 20 3 20 11 20 3 20 3 20 3 11 20 3 20 3 20 3 20 3 20 3 20 3 20
25
6 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 10...

output:

13
11
10
16
4
8
7
18
4
4
3
8
15
11
8
10
18
3
4
11

result:

ok 20 lines

Test #76:

score: 10
Accepted
time: 0ms
memory: 26500kb

input:

4
124
41 58 95 58 95 58 95 58 95 58 95 58 100 58 95 58 95 58 95 58 95 100 58 95 58 95 58 95 58 95 58 95 58 95 58 95 58 95 100 58 95 58 95 58 100 58 95 58 95 58 95 58 95 58 95 58 95 58 95 58 100 58 95 58 95 58 95 58 95 58 95 58 95 100 58 95 58 95 100 58 95 58 95 58 95 58 95 58 95 58 95 58 95 100 58 9...

output:

50
16
90
66

result:

ok 4 lines

Test #77:

score: 10
Accepted
time: 3ms
memory: 26332kb

input:

1
498
246 440 479 440 479 440 479 440 479 440 479 440 479 440 479 440 479 420 440 479 440 479 440 479 440 479 440 479 440 479 420 440 479 440 479 440 479 440 479 440 479 440 479 440 479 440 479 440 479 420 440 479 440 479 440 479 420 440 479 440 479 440 479 440 479 440 479 440 479 440 479 440 479 44...

output:

361

result:

ok single line: '361'

Test #78:

score: 10
Accepted
time: 0ms
memory: 26396kb

input:

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

output:

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

result:

ok 47 lines

Test #79:

score: 10
Accepted
time: 0ms
memory: 26444kb

input:

24
20
8 14 3 19 9 10 5 18 16 11 1 8 14 3 19 9 10 5 18 16
20
12 11 12 5 7 12 2 20 1 19 1 12 11 12 5 7 12 2 20 1
20
20 11 1 19 16 2 9 1 14 16 1 20 11 1 19 16 2 9 1 14
20
20 17 11 12 7 18 17 13 12 2 1 20 17 11 12 7 18 17 13 12
20
18 17 15 2 6 8 2 17 11 10 1 18 17 15 2 6 8 2 17 11
20
4 10 11 3 4 19 16 6...

output:

18
15
15
16
17
17
16
17
18
18
17
17
18
17
18
17
18
17
18
18
18
17
17
17

result:

ok 24 lines

Test #80:

score: 10
Accepted
time: 4ms
memory: 26464kb

input:

10
50
11 31 46 3 1 39 5 17 21 31 10 36 20 2 43 29 38 8 21 26 30 26 46 42 19 1 11 31 46 3 1 39 5 17 21 31 10 36 20 2 43 29 38 8 21 26 30 26 46 42
50
10 24 48 46 4 45 17 24 41 47 25 4 13 38 42 46 47 19 30 18 8 4 19 17 29 1 10 24 48 46 4 45 17 24 41 47 25 4 13 38 42 46 47 19 30 18 8 4 19 17
50
37 29 21...

output:

42
44
43
40
40
43
42
44
42
45

result:

ok 10 lines

Test #81:

score: 10
Accepted
time: 3ms
memory: 26456kb

input:

21
23
20 15 7 1 14 19 1 11 22 19 7 1 20 15 7 1 14 19 1 11 22 19 7
23
15 1 2 19 10 13 15 11 9 4 7 1 15 1 2 19 10 13 15 11 9 4 7
23
15 18 12 14 22 9 14 6 16 5 15 1 15 18 12 14 22 9 14 6 16 5 15
23
19 22 17 11 14 21 9 1 15 8 18 1 19 22 17 11 14 21 9 1 15 8 18
23
9 12 3 14 20 3 19 4 22 1 22 1 9 12 3 14 ...

output:

15
16
17
18
16
19
17
17
20
19
20
20
21
21
20
20
21
21
21
20
20

result:

ok 21 lines

Test #82:

score: 10
Accepted
time: 0ms
memory: 26456kb

input:

4
124
80 98 31 65 9 54 50 51 75 26 88 53 46 66 61 59 42 117 72 122 101 34 104 11 29 54 55 118 40 119 47 76 113 49 20 23 56 88 44 45 33 63 82 37 54 85 14 41 116 89 71 97 112 116 80 71 96 82 93 108 105 124 1 80 98 31 65 9 54 50 51 75 26 88 53 46 66 61 59 42 117 72 122 101 34 104 11 29 54 55 118 40 119...

output:

119
119
120
119

result:

ok 4 lines

Test #83:

score: 10
Accepted
time: 4ms
memory: 24460kb

input:

1
496
460 199 180 388 477 220 495 339 84 65 382 120 127 34 258 407 390 463 452 357 459 242 438 256 456 55 488 223 389 297 198 85 396 475 275 242 194 109 321 288 430 363 284 316 75 295 421 287 112 204 76 438 418 3 355 6 470 373 421 274 252 387 478 297 451 443 324 6 192 331 115 142 207 251 144 373 109...

output:

488

result:

ok single line: '488'

Test #84:

score: 10
Accepted
time: 4ms
memory: 26528kb

input:

233
2
1 2
2
2 1
2
2 1
2
1 2
2
2 1
2
1 2
2
2 1
2
1 2
2
2 1
2
2 1
2
2 1
2
1 2
2
1 2
2
2 1
2
2 1
2
1 2
2
2 1
2
2 1
2
2 1
2
2 1
2
2 1
2
2 1
2
1 2
2
2 1
2
2 1
2
1 2
2
2 1
2
2 1
2
1 2
2
1 2
2
1 2
2
1 2
2
2 1
2
2 1
2
2 1
2
1 2
2
2 1
2
1 2
2
1 2
2
1 2
2
2 1
2
2 1
2
1 2
2
1 2
2
1 2
2
2 1
2
1 2
2
1 2
2
2 1
2
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 233 lines

Test #85:

score: 10
Accepted
time: 0ms
memory: 24408kb

input:

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

output:

7
7
6
6
6
5
8
5
5
6
6
6
8
6
7
8
6
6
6
7
7
6
7
5
6
7
4
6
6
8
8
8
7
7
7
8
7
7
7
8
7
7
6
8
8
6
7
6

result:

ok 48 lines

Test #86:

score: 10
Accepted
time: 0ms
memory: 26472kb

input:

25
19
13 3 6 1 2 7 1 10 8 12 18 1 7 16 3 19 8 5 8
20
16 20 10 8 4 5 2 13 2 9 17 5 6 3 10 11 10 12 2 6
20
8 9 10 15 9 20 12 10 7 5 14 15 20 12 14 20 2 18 16 17
20
1 4 20 4 7 18 10 9 8 16 8 10 19 2 4 18 13 7 14 20
20
2 11 4 6 17 20 2 18 11 14 15 18 3 5 19 10 9 3 17 6
20
14 1 11 8 15 13 10 5 19 9 8 6 3...

output:

14
15
16
16
16
16
16
17
15
16
16
16
15
16
15
15
16
15
16
16
16
14
15
16
16

result:

ok 25 lines

Test #87:

score: 10
Accepted
time: 0ms
memory: 26528kb

input:

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

output:

43
44
44
46
44
45
44
43
44
46

result:

ok 10 lines

Test #88:

score: 10
Accepted
time: 4ms
memory: 26372kb

input:

20
24
22 18 12 24 11 21 20 17 11 3 21 5 1 11 17 16 11 22 5 8 14 6 8 19
25
17 6 7 12 24 23 12 1 15 3 20 6 7 8 22 23 20 12 9 23 8 10 25 5 15
25
9 25 13 6 14 13 6 4 5 12 13 8 6 14 12 17 3 1 20 2 20 10 24 10 4
25
1 13 2 15 4 17 12 7 6 8 19 7 22 24 15 6 23 13 4 18 13 16 4 10 6
25
20 7 3 14 17 11 18 15 9 ...

output:

20
20
21
20
20
20
20
21
19
20
21
21
22
22
20
21
20
20
21
20

result:

ok 20 lines

Test #89:

score: 10
Accepted
time: 6ms
memory: 26400kb

input:

4
124
98 92 44 40 110 41 40 37 51 18 54 61 73 77 30 45 37 122 29 65 4 108 86 84 11 106 61 78 67 19 58 81 106 123 124 7 83 30 97 58 86 81 77 124 102 96 58 98 92 40 59 82 34 11 95 55 98 1 58 62 117 63 105 33 61 25 28 14 120 89 103 65 84 107 40 51 72 17 39 64 47 113 68 52 116 98 73 4 93 110 113 30 18 2...

output:

118
119
118
119

result:

ok 4 lines

Test #90:

score: 10
Accepted
time: 0ms
memory: 26420kb

input:

1
495
301 485 208 223 357 107 240 431 453 493 289 275 292 209 161 333 100 277 348 89 215 399 45 380 226 252 17 150 437 70 106 246 322 149 235 354 64 270 356 264 493 39 472 76 345 191 86 392 213 313 316 486 107 43 171 89 340 364 482 443 316 215 122 206 222 326 54 222 41 405 284 405 407 490 269 407 14...

output:

487

result:

ok single line: '487'

Subtask #3:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #91:

score: 25
Accepted
time: 6ms
memory: 26372kb

input:

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

output:

8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
...

result:

ok 396 lines

Test #92:

score: 25
Accepted
time: 0ms
memory: 26460kb

input:

193
20
7 2 17 20 5 4 12 3 13 1 11 8 9 15 18 16 14 19 10 6
20
15 16 6 13 12 9 19 2 10 8 20 18 1 3 11 17 5 7 14 4
20
4 20 14 13 2 15 10 8 6 3 1 16 12 9 19 7 11 18 17 5
20
6 13 18 17 9 10 8 4 7 14 12 20 19 16 1 11 3 5 15 2
20
4 13 2 15 1 11 18 5 19 7 8 3 16 17 14 9 10 12 20 6
20
7 12 13 3 20 16 2 10 11...

output:

18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
...

result:

ok 193 lines

Test #93:

score: 25
Accepted
time: 0ms
memory: 26460kb

input:

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

output:

49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
49
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50

result:

ok 77 lines

Test #94:

score: 25
Accepted
time: 2ms
memory: 26388kb

input:

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

output:

60
60
60
60
60
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61
61

result:

ok 63 lines

Test #95:

score: 25
Accepted
time: 2ms
memory: 26472kb

input:

4
993
63 51 630 796 579 766 924 679 394 261 908 486 543 273 382 619 42 613 260 629 39 246 293 109 611 447 501 149 374 362 717 769 612 953 983 413 638 721 772 95 948 286 667 877 355 889 989 236 674 921 351 361 530 691 910 777 724 11 727 369 941 562 148 733 898 435 649 956 173 848 806 504 488 553 44 2...

output:

991
991
992
992

result:

ok 4 lines

Test #96:

score: 25
Accepted
time: 3ms
memory: 26740kb

input:

1
3969
1728 1713 701 3683 336 2736 1097 3094 1082 1893 2130 3909 977 2998 1442 407 2358 607 1556 3052 3371 2226 3917 3246 3454 1415 583 3650 2513 3027 3318 2470 289 2425 1423 16 3956 497 278 1513 3405 2087 1858 2315 3329 3374 1685 610 3912 1343 3175 2936 1387 3597 1391 642 3273 1895 2217 2737 3926 1...

output:

3967

result:

ok single line: '3967'

Test #97:

score: 25
Accepted
time: 7ms
memory: 26448kb

input:

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

output:

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

result:

ok 367 lines

Test #98:

score: 0
Wrong Answer
time: 0ms
memory: 26444kb

input:

200
19
8 17 15 1 18 12 15 6 3 6 1 5 9 5 12 2 9 3 18
19
19 8 7 1 11 4 11 19 13 19 11 7 19 13 19 11 7 11 7
19
11 10 1 17 16 17 4 3 11 15 11 16 10 7 4 7 4 14 12
19
19 2 10 14 3 5 10 14 15 9 7 13 7 15 18 6 14 8 6
19
8 7 1 19 6 7 8 7 19 11 8 9 19 7 11 9 19 18 6
19
12 18 16 9 1 19 1 9 16 9 4 12 4 8 19 1 1...

output:

15
15
14
15
12
14
15
14
12
10
14
15
11
14
13
10
14
15
10
15
14
12
14
15
12
16
13
14
10
16
16
15
14
14
12
12
13
13
12
13
15
14
15
16
11
16
14
16
15
13
11
15
13
15
7
15
15
16
14
14
16
13
13
11
15
12
12
13
13
13
16
14
13
13
12
12
11
16
14
16
14
13
12
11
13
12
11
13
16
13
15
16
13
15
15
17
13
15
14
15
1...

result:

wrong answer 161st lines differ - expected: '11', found: '12'

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%