QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#584658#9182. Infinite RaceZhangYiDe85 15ms5256kbC++20431b2024-09-23 16:04:262024-09-23 16:04:27

詳細信息

Subtask #1:

score: 29
Accepted

Test #1:

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

input:

2
1
1

output:

0

result:

ok single line: '0'

Test #2:

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

input:

2
2
1
-1

output:

0

result:

ok single line: '0'

Test #3:

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

input:

2
5
-1
-1
-1
-1
1

output:

0

result:

ok single line: '0'

Test #4:

score: 29
Accepted
time: 5ms
memory: 3700kb

input:

2
200000
1
1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
-1
1
1
-1
1
1
-1
-1
1
-1
-1
1
-1
1
-1
1
1
1
1
-1
1
-1
-1
-1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
1
-1
-1
-1
-1
-1
1
-1
-1
1
1
1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
1
-1
1
-1
1
-1
-1
1
-1
1
1
-1
1
-1
1
-1
1
-1
1
-1
-1
-1
-1
-1
1
-1
-1
1
1
1
1
1
1
-1
-1
-...

output:

50154

result:

ok single line: '50154'

Test #5:

score: 29
Accepted
time: 8ms
memory: 3700kb

input:

2
200000
1
-1
1
-1
1
1
-1
1
-1
-1
1
-1
1
1
1
1
-1
-1
1
1
1
1
-1
1
-1
1
1
1
-1
-1
1
-1
-1
-1
1
1
1
1
-1
1
1
1
-1
1
1
1
-1
1
1
1
-1
1
1
1
1
1
1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
1
1
1
1
-1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
-1
1
1
-1
-1
-1
1
-1
1
1
-1
-1
1...

output:

50172

result:

ok single line: '50172'

Test #6:

score: 29
Accepted
time: 7ms
memory: 3648kb

input:

2
200000
1
1
1
1
1
1
1
1
-1
1
1
1
1
-1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
-1
1
-1
1
-1
-1
1
1
1
1
1
-1
1
1
1
-1
-1
-1
1
-1
1
1
-1
-1
1
-1
1
1
-1
1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
1
1
-1
-1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
1
1
1
-1
1
1
1
1
-1
1
-1
-1
-1
1
1
1
-1
-1
1
1
-1
1
-1
-1
-1
1
...

output:

49713

result:

ok single line: '49713'

Test #7:

score: 29
Accepted
time: 8ms
memory: 3572kb

input:

2
200000
1
-1
-1
1
-1
1
-1
1
1
-1
1
-1
-1
-1
-1
-1
-1
-1
1
1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
1
-1
1
-1
1
1
1
1
-1
-1
1
-1
-1
1
1
1
1
-1
-1
1
-1
-1
1
1
-1
1
-1
1
1
1
-1
-1
-1
-1
-1
1
1
-1
-1
1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
1
1
-1
1
-1
-1
-1
1
1
-1
1
1
1
-1
1
1
1
1
1
-1
-1
1...

output:

49564

result:

ok single line: '49564'

Test #8:

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

input:

2
100
-1
1
-1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
1
1
1
1
1
1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
1
1
1
-1
1
1
1
-1
1
-1
1
1
-1
1
-1
-1
-1
-1

output:

16

result:

ok single line: '16'

Test #9:

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

input:

2
2
1
1

output:

1

result:

ok single line: '1'

Test #10:

score: 29
Accepted
time: 6ms
memory: 3640kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

199999

result:

ok single line: '199999'

Test #11:

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

input:

2
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

99

result:

ok single line: '99'

Test #12:

score: 29
Accepted
time: 6ms
memory: 3716kb

input:

2
200000
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-...

output:

0

result:

ok single line: '0'

Test #13:

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

input:

2
100
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1

output:

0

result:

ok single line: '0'

Test #14:

score: 29
Accepted
time: 8ms
memory: 3652kb

input:

2
200000
1
1
1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
1
1
1
-1
1
-1
1
-1
-1
-1
1
-1
1
1
-1
-1
-1
-1
1
1
1
-1
-1
1
-1
1
1
1
1
1
1
-1
1
-1
1
1
-1
-1
-1
1
1
-1
1
1
-1
-1
-1
-1
-1
-1
-1
1
-1
1
1
1
1
1
1
-1
1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
1
-1
1
1
-1
-1
1
1
1
-1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
1
1
-1
-1
1
1
1...

output:

50402

result:

ok single line: '50402'

Test #15:

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

input:

2
100
1
1
1
-1
1
1
1
-1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
-1
1
-1
1
-1
-1
1
-1
1
1
1
-1
-1
-1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
1
1
1
1
-1
-1
-1
1
1
1
1
1
-1
1
-1
-1
-1
1
1
-1
1
-1
-1
-1
1
-1
-1
1
1

output:

27

result:

ok single line: '27'

Test #16:

score: 29
Accepted
time: 4ms
memory: 3640kb

input:

2
200000
1
-1
1
-1
-1
-1
1
1
1
1
1
1
-1
-1
1
1
1
-1
1
1
1
-1
1
-1
1
1
1
1
-1
-1
1
-1
1
-1
-1
1
1
1
1
1
1
-1
-1
1
-1
1
-1
-1
1
-1
1
-1
1
1
-1
-1
1
-1
1
-1
1
1
-1
1
1
1
1
1
1
-1
-1
-1
-1
1
-1
1
1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
-1
1
-1
-1
-1
1
1
-1
1
-1
-1
-1
-1
1
1
-1
1
-1
1
-1
-1
-1
1
-1
-1
-1
1
1...

output:

49885

result:

ok single line: '49885'

Test #17:

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

input:

2
100
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
1
1
-1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
-1
1
-1
1
1
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

84

result:

ok single line: '84'

Test #18:

score: 29
Accepted
time: 6ms
memory: 3568kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

199987

result:

ok single line: '199987'

Test #19:

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

input:

2
4
1
1
1
1

output:

3

result:

ok single line: '3'

Test #20:

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

input:

2
5
1
-1
1
-1
-1

output:

0

result:

ok single line: '0'

Subtask #2:

score: 34
Accepted

Test #21:

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

input:

2
2
1
1

output:

1

result:

ok single line: '1'

Test #22:

score: 34
Accepted
time: 6ms
memory: 3588kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

199999

result:

ok single line: '199999'

Test #23:

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

input:

2
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

99

result:

ok single line: '99'

Test #24:

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

input:

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

output:

1

result:

ok single line: '1'

Test #25:

score: 34
Accepted
time: 7ms
memory: 5092kb

input:

200000
200000
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
9...

output:

1

result:

ok single line: '1'

Test #26:

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

input:

200000
1
182487

output:

0

result:

ok single line: '0'

Test #27:

score: 34
Accepted
time: 3ms
memory: 3624kb

input:

3
200000
1
2
1
2
2
2
1
1
1
2
2
2
1
2
2
2
2
1
1
2
2
1
2
2
1
2
2
1
2
1
1
2
2
2
2
2
1
2
2
2
1
1
2
1
1
2
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
1
2
1
1
1
2
1
1
2
1
1
1
2
1
1
2
2
2
1
1
1
1
2
1
2
2
1
2
1
2
1
2
1
2
2
2
1
2
2
2
1
1
1
1
2
1
1
2
2
2
2
1
2
1
2
1
1
2
2
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
2
2
2
2
2
2
1
1
1
2
2...

output:

133415

result:

ok single line: '133415'

Test #28:

score: 34
Accepted
time: 7ms
memory: 3632kb

input:

4
200000
3
2
1
3
2
2
2
1
1
1
2
3
3
2
1
1
1
3
1
1
3
3
1
1
3
1
2
2
1
2
1
3
2
2
2
2
1
3
1
1
2
2
3
1
1
3
1
3
1
3
3
2
1
2
3
1
1
1
3
2
1
3
2
2
2
3
1
3
2
3
2
2
3
1
1
3
1
2
2
1
2
1
1
1
1
2
2
1
2
2
1
2
2
1
2
2
3
2
3
2
3
1
3
2
3
2
1
3
3
2
3
3
2
3
3
3
3
3
3
2
3
2
2
1
3
2
3
2
3
2
1
1
2
2
3
2
3
1
1
2
3
2
3
3
2
2...

output:

105734

result:

ok single line: '105734'

Test #29:

score: 34
Accepted
time: 6ms
memory: 3652kb

input:

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

output:

57864

result:

ok single line: '57864'

Test #30:

score: 34
Accepted
time: 8ms
memory: 3588kb

input:

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

output:

31054

result:

ok single line: '31054'

Test #31:

score: 34
Accepted
time: 8ms
memory: 3564kb

input:

203
200000
100
186
4
75
56
130
181
36
161
3
191
32
73
58
164
195
30
33
131
124
53
99
135
140
1
124
29
89
16
34
161
152
54
188
65
43
181
28
83
169
160
47
44
59
145
195
79
27
176
18
179
144
11
195
36
85
169
90
146
93
73
66
11
155
133
63
90
108
107
90
137
65
143
120
154
94
86
202
122
17
56
71
84
179
11...

output:

11485

result:

ok single line: '11485'

Test #32:

score: 34
Accepted
time: 9ms
memory: 3688kb

input:

4000
200000
2985
3407
1143
3560
1007
1855
1639
590
2231
1529
1435
3586
1692
2369
3019
1377
331
3435
1266
2126
2560
3319
295
303
892
360
3487
2092
2712
3029
626
672
228
3846
493
3026
1981
1196
2227
1411
1463
3677
1658
714
630
860
3156
2080
2963
1977
2485
2147
2792
2299
371
1559
2848
2324
3115
851
347...

output:

2483

result:

ok single line: '2483'

Test #33:

score: 34
Accepted
time: 10ms
memory: 3952kb

input:

50000
200000
41213
30997
8619
41861
41316
30105
15006
5065
11015
16985
31909
37042
39467
40487
19883
28554
27460
15459
25824
13158
13066
35584
18001
12362
2818
25831
41729
38972
7193
37946
26803
47535
24225
38582
11225
18966
7044
30591
39076
47171
26818
48011
43377
14636
38329
19199
26087
4199
27793...

output:

708

result:

ok single line: '708'

Test #34:

score: 34
Accepted
time: 15ms
memory: 5120kb

input:

200000
200000
152734
110923
16496
149622
42618
139250
114608
26400
7774
14830
41079
28404
141560
75920
122036
159829
188426
1794
58069
67219
56319
87589
152026
49931
198814
121631
50352
35306
149116
96622
76915
32475
19261
145376
171230
135192
9951
12008
120134
56675
9658
365
164993
86997
101564
463...

output:

355

result:

ok single line: '355'

Test #35:

score: 34
Accepted
time: 10ms
memory: 5256kb

input:

200000
200000
27246
74011
14368
132003
132822
73717
178219
138282
64714
1226
87554
9175
85526
136668
35925
137518
192376
7331
5282
114513
109561
15792
123812
27275
103776
150744
63065
44068
41587
8571
164073
70684
31713
126280
129481
127543
74628
53503
157457
53412
48385
118805
190850
61145
759
6632...

output:

353

result:

ok single line: '353'

Test #36:

score: 34
Accepted
time: 14ms
memory: 5192kb

input:

200000
200000
38946
72672
90488
178872
198147
148517
21120
135564
141486
146690
158535
117398
53985
61630
32324
166488
191602
182605
17450
10007
44955
2832
164706
106964
73485
47865
180127
177432
153405
118096
34895
53548
1579
27202
181777
187006
169313
126798
137850
77449
194252
194736
143109
17519...

output:

371

result:

ok single line: '371'

Test #37:

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

input:

100
100
92
24
44
6
56
47
78
13
79
24
86
40
7
40
3
33
1
63
9
82
73
40
4
92
88
1
9
77
24
27
22
74
55
26
49
99
64
28
20
49
62
11
78
10
69
76
93
96
18
65
20
2
91
4
81
61
41
29
18
3
93
6
31
7
91
58
78
46
56
69
92
46
96
36
22
84
4
8
62
64
61
38
91
2
87
46
27
63
35
55
10
7
74
60
73
45
83
94
40
70

output:

7

result:

ok single line: '7'

Test #38:

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

input:

100
100
26
26
11
16
83
11
16
16
11
26
11
16
11
16
26
16
11
16
99
16
11
26
26
11
16
27
26
11
16
11
11
11
11
16
26
92
16
16
11
26
16
11
26
16
16
26
16
16
11
11
26
16
26
11
11
26
1
11
2
11
11
11
11
16
16
16
26
11
11
80
16
26
16
26
26
11
11
26
16
35
26
26
26
38
11
11
11
16
16
16
26
16
20
11
26
26
16
26
...

output:

46

result:

ok single line: '46'

Test #39:

score: 34
Accepted
time: 11ms
memory: 5120kb

input:

200000
200000
29665
27299
91359
91359
29665
91359
91359
91359
91359
29665
27299
27299
29665
23871
91359
91359
29665
91359
27299
27299
91359
29665
27299
37574
91359
29665
91359
52912
91359
27299
29665
27299
27299
27299
27299
29665
30652
91359
29665
29665
91359
29665
27299
81391
27299
91359
27299
2966...

output:

95191

result:

ok single line: '95191'

Test #40:

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

input:

100
100
66
66
8
8
45
45
97
97
58
58
34
34
71
71
20
69
69
54
54
53
53
43
43
88
88
34
34
76
76
74
74
62
62
42
42
50
50
89
89
66
66
44
44
56
56
96
96
33
33
15
20
15
24
24
12
12
64
64
46
46
21
21
15
15
92
99
99
68
41
87
87
64
64
17
17
73
73
58
44
66
58
92
92
68
68
51
49
49
52
6
49
52
7
7
71
71
50
50
95
95

output:

45

result:

ok single line: '45'

Test #41:

score: 34
Accepted
time: 12ms
memory: 5188kb

input:

200000
200000
48508
48508
192753
192753
128554
128554
9725
9725
81029
81029
24266
24266
94313
94313
153565
153565
64878
64878
24712
24712
50046
50046
196752
196752
140257
140257
72031
72031
180537
180537
68161
68161
30314
30314
179259
179259
162787
162787
11787
11787
21698
21698
179267
179267
154017...

output:

99995

result:

ok single line: '99995'

Test #42:

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

input:

2
4
1
1
1
1

output:

3

result:

ok single line: '3'

Test #43:

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

input:

200000
7
199999
199999
1
199999
55
199999
55

output:

3

result:

ok single line: '3'

Test #44:

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

input:

3
6
1
2
2
2
1
1

output:

3

result:

ok single line: '3'

Subtask #3:

score: 22
Accepted

Test #45:

score: 22
Accepted
time: 0ms
memory: 3520kb

input:

2
1
1

output:

0

result:

ok single line: '0'

Test #46:

score: 22
Accepted
time: 0ms
memory: 3568kb

input:

2
2
1
-1

output:

0

result:

ok single line: '0'

Test #47:

score: 22
Accepted
time: 0ms
memory: 3712kb

input:

2
5
-1
-1
-1
-1
1

output:

0

result:

ok single line: '0'

Test #48:

score: 22
Accepted
time: 0ms
memory: 3584kb

input:

2
100
-1
1
-1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
1
1
1
1
1
1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
1
1
1
-1
1
1
1
-1
1
-1
1
1
-1
1
-1
-1
-1
-1

output:

16

result:

ok single line: '16'

Test #49:

score: 22
Accepted
time: 0ms
memory: 3712kb

input:

2
2
1
1

output:

1

result:

ok single line: '1'

Test #50:

score: 22
Accepted
time: 0ms
memory: 3640kb

input:

2
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

99

result:

ok single line: '99'

Test #51:

score: 22
Accepted
time: 0ms
memory: 3640kb

input:

2
100
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1

output:

0

result:

ok single line: '0'

Test #52:

score: 22
Accepted
time: 0ms
memory: 3564kb

input:

2
100
1
1
1
-1
1
1
1
-1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
-1
1
-1
1
-1
-1
1
-1
1
1
1
-1
-1
-1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
1
1
1
1
-1
-1
-1
1
1
1
1
1
-1
1
-1
-1
-1
1
1
-1
1
-1
-1
-1
1
-1
-1
1
1

output:

27

result:

ok single line: '27'

Test #53:

score: 22
Accepted
time: 0ms
memory: 3692kb

input:

2
100
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
1
1
-1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
-1
1
-1
1
1
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

84

result:

ok single line: '84'

Test #54:

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

input:

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

output:

1

result:

ok single line: '1'

Test #55:

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

input:

100
100
92
24
44
6
56
47
78
13
79
24
86
40
7
40
3
33
1
63
9
82
73
40
4
92
88
1
9
77
24
27
22
74
55
26
49
99
64
28
20
49
62
11
78
10
69
76
93
96
18
65
20
2
91
4
81
61
41
29
18
3
93
6
31
7
91
58
78
46
56
69
92
46
96
36
22
84
4
8
62
64
61
38
91
2
87
46
27
63
35
55
10
7
74
60
73
45
83
94
40
70

output:

7

result:

ok single line: '7'

Test #56:

score: 22
Accepted
time: 0ms
memory: 3568kb

input:

100
100
26
26
11
16
83
11
16
16
11
26
11
16
11
16
26
16
11
16
99
16
11
26
26
11
16
27
26
11
16
11
11
11
11
16
26
92
16
16
11
26
16
11
26
16
16
26
16
16
11
11
26
16
26
11
11
26
1
11
2
11
11
11
11
16
16
16
26
11
11
80
16
26
16
26
26
11
11
26
16
35
26
26
26
38
11
11
11
16
16
16
26
16
20
11
26
26
16
26
...

output:

46

result:

ok single line: '46'

Test #57:

score: 22
Accepted
time: 0ms
memory: 3716kb

input:

100
100
66
66
8
8
45
45
97
97
58
58
34
34
71
71
20
69
69
54
54
53
53
43
43
88
88
34
34
76
76
74
74
62
62
42
42
50
50
89
89
66
66
44
44
56
56
96
96
33
33
15
20
15
24
24
12
12
64
64
46
46
21
21
15
15
92
99
99
68
41
87
87
64
64
17
17
73
73
58
44
66
58
92
92
68
68
51
49
49
52
6
49
52
7
7
71
71
50
50
95
95

output:

45

result:

ok single line: '45'

Test #58:

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

input:

100
100
-14
29
-84
-95
83
83
90
-29
5
1
22
-32
23
-53
38
89
53
-46
-69
-69
-60
-40
-33
-91
-81
3
55
47
5
42
31
-58
-98
-49
74
-29
3
-92
-17
81
58
54
-24
14
82
98
33
43
-66
-6
16
14
26
-19
-57
-51
-86
30
-62
34
-23
-25
10
-45
5
25
-60
-89
7
6
-77
-30
-47
-99
-73
80
-59
85
-94
14
-86
-70
63
-58
87
32
...

output:

4

result:

ok single line: '4'

Test #59:

score: 22
Accepted
time: 0ms
memory: 3560kb

input:

100
100
35
-91
-76
62
-76
51
-71
-19
-44
-76
86
84
88
13
-25
-76
38
-97
23
-77
-80
-56
68
56
-3
79
17
22
-64
54
-90
20
84
4
15
-7
-23
-35
73
85
-33
50
-85
-72
84
-94
48
-84
-67
-71
-69
-57
-47
10
-58
22
26
51
-53
-77
-29
-91
5
66
21
-85
45
-37
91
2
-19
78
56
22
21
49
-5
-26
-73
12
-50
36
24
-64
-91
...

output:

3

result:

ok single line: '3'

Test #60:

score: 22
Accepted
time: 0ms
memory: 3692kb

input:

100
100
-99
-63
-4
-16
-7
-49
-41
-55
-70
-11
-65
-42
-98
-85
-25
-52
-30
-72
98
-79
99
70
-73
-53
-93
-46
-2
-19
19
2
4
-59
-90
-82
90
-40
-18
-34
-4
-87
85
82
46
-67
-36
-19
52
-35
-37
-31
-96
49
-28
-15
-99
-52
-71
-88
-95
-90
-12
37
72
19
-2
-94
-85
-54
-20
11
88
25
96
-43
-83
-48
7
-25
59
95
-9...

output:

0

result:

ok single line: '0'

Test #61:

score: 22
Accepted
time: 0ms
memory: 3716kb

input:

100
100
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
8...

output:

0

result:

ok single line: '0'

Test #62:

score: 22
Accepted
time: 0ms
memory: 3620kb

input:

100
100
71
71
-77
71
-71
81
-71
71
-71
77
77
-77
-71
-71
-71
-24
77
71
51
-71
22
71
71
77
77
-71
-71
23
71
-71
71
-7
77
-77
-50
71
77
64
-77
-71
71
71
71
77
77
-77
-42
-77
-77
71
71
-71
71
-71
71
77
56
-71
71
-77
71
71
-71
71
71
77
77
71
10
-71
71
71
71
77
-71
12
71
-77
-71
71
71
-71
-77
-71
-71
-71...

output:

21

result:

ok single line: '21'

Test #63:

score: 22
Accepted
time: 0ms
memory: 3632kb

input:

100
100
-45
-68
-7
-1
-82
-22
-89
-7
-20
-50
-38
-79
-9
-87
-11
-35
-61
-45
-24
-95
-43
-39
-81
-92
-62
-81
-70
-91
-7
-73
-45
-26
-22
-76
-27
-46
-51
-42
-17
-11
-11
-95
-50
-79
-18
-34
-56
-3
-21
-93
-71
-49
-51
-7
-75
-84
-65
-25
-17
-56
-43
-17
-88
-29
-44
-60
-41
-80
-78
-30
-78
-96
-46
-82
-31...

output:

0

result:

ok single line: '0'

Test #64:

score: 22
Accepted
time: 0ms
memory: 3580kb

input:

100
100
11
11
24
24
67
67
97
97
17
17
28
28
29
29
71
71
24
24
41
41
64
64
18
-70
18
10
10
24
24
52
52
7
7
87
87
85
85
89
89
69
76
69
13
21
21
45
45
2
2
-60
25
25
61
61
33
33
41
41
65
65
94
94
82
82
38
-79
24
38
-23
20
-3
20
17
17
73
73
47
47
90
90
65
65
7
7
98
98
57
57
15
15
8
16
8
14
14
88
88
50
50...

output:

45

result:

ok single line: '45'

Test #65:

score: 22
Accepted
time: 0ms
memory: 3632kb

input:

4
5
-2
2
1
-3
2

output:

1

result:

ok single line: '1'

Test #66:

score: 22
Accepted
time: 0ms
memory: 3560kb

input:

2
4
1
1
1
1

output:

3

result:

ok single line: '3'

Test #67:

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

input:

2
5
1
-1
1
-1
-1

output:

0

result:

ok single line: '0'

Test #68:

score: 22
Accepted
time: 0ms
memory: 3632kb

input:

3
6
1
2
2
2
1
1

output:

3

result:

ok single line: '3'

Subtask #4:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #69:

score: 15
Accepted
time: 0ms
memory: 3560kb

input:

2
1
1

output:

0

result:

ok single line: '0'

Test #70:

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

input:

2
2
1
-1

output:

0

result:

ok single line: '0'

Test #71:

score: 15
Accepted
time: 0ms
memory: 3520kb

input:

2
5
-1
-1
-1
-1
1

output:

0

result:

ok single line: '0'

Test #72:

score: 15
Accepted
time: 7ms
memory: 3656kb

input:

2
200000
1
1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
-1
1
1
-1
1
1
-1
-1
1
-1
-1
1
-1
1
-1
1
1
1
1
-1
1
-1
-1
-1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
1
-1
-1
-1
-1
-1
1
-1
-1
1
1
1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
1
-1
1
-1
1
-1
-1
1
-1
1
1
-1
1
-1
1
-1
1
-1
1
-1
-1
-1
-1
-1
1
-1
-1
1
1
1
1
1
1
-1
-1
-...

output:

50154

result:

ok single line: '50154'

Test #73:

score: 15
Accepted
time: 8ms
memory: 3560kb

input:

2
200000
1
-1
1
-1
1
1
-1
1
-1
-1
1
-1
1
1
1
1
-1
-1
1
1
1
1
-1
1
-1
1
1
1
-1
-1
1
-1
-1
-1
1
1
1
1
-1
1
1
1
-1
1
1
1
-1
1
1
1
-1
1
1
1
1
1
1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
1
1
1
1
-1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
-1
1
1
-1
-1
-1
1
-1
1
1
-1
-1
1...

output:

50172

result:

ok single line: '50172'

Test #74:

score: 15
Accepted
time: 7ms
memory: 3624kb

input:

2
200000
1
1
1
1
1
1
1
1
-1
1
1
1
1
-1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
-1
1
-1
1
-1
-1
1
1
1
1
1
-1
1
1
1
-1
-1
-1
1
-1
1
1
-1
-1
1
-1
1
1
-1
1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
1
1
-1
-1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
1
1
1
-1
1
1
1
1
-1
1
-1
-1
-1
1
1
1
-1
-1
1
1
-1
1
-1
-1
-1
1
...

output:

49713

result:

ok single line: '49713'

Test #75:

score: 15
Accepted
time: 4ms
memory: 3656kb

input:

2
200000
1
-1
-1
1
-1
1
-1
1
1
-1
1
-1
-1
-1
-1
-1
-1
-1
1
1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
1
-1
1
-1
1
1
1
1
-1
-1
1
-1
-1
1
1
1
1
-1
-1
1
-1
-1
1
1
-1
1
-1
1
1
1
-1
-1
-1
-1
-1
1
1
-1
-1
1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
1
1
-1
1
-1
-1
-1
1
1
-1
1
1
1
-1
1
1
1
1
1
-1
-1
1...

output:

49564

result:

ok single line: '49564'

Test #76:

score: 15
Accepted
time: 0ms
memory: 3640kb

input:

2
100
-1
1
-1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
1
1
1
1
1
1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
1
1
1
-1
1
1
1
-1
1
-1
1
1
-1
1
-1
-1
-1
-1

output:

16

result:

ok single line: '16'

Test #77:

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

input:

2
2
1
1

output:

1

result:

ok single line: '1'

Test #78:

score: 15
Accepted
time: 6ms
memory: 3588kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

199999

result:

ok single line: '199999'

Test #79:

score: 15
Accepted
time: 0ms
memory: 3636kb

input:

2
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

99

result:

ok single line: '99'

Test #80:

score: 15
Accepted
time: 8ms
memory: 3628kb

input:

2
200000
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-...

output:

0

result:

ok single line: '0'

Test #81:

score: 15
Accepted
time: 0ms
memory: 3564kb

input:

2
100
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1

output:

0

result:

ok single line: '0'

Test #82:

score: 15
Accepted
time: 8ms
memory: 3652kb

input:

2
200000
1
1
1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
1
1
1
-1
1
-1
1
-1
-1
-1
1
-1
1
1
-1
-1
-1
-1
1
1
1
-1
-1
1
-1
1
1
1
1
1
1
-1
1
-1
1
1
-1
-1
-1
1
1
-1
1
1
-1
-1
-1
-1
-1
-1
-1
1
-1
1
1
1
1
1
1
-1
1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
1
-1
1
1
-1
-1
1
1
1
-1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
1
1
-1
-1
1
1
1...

output:

50402

result:

ok single line: '50402'

Test #83:

score: 15
Accepted
time: 0ms
memory: 3688kb

input:

2
100
1
1
1
-1
1
1
1
-1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
-1
1
-1
1
-1
-1
1
-1
1
1
1
-1
-1
-1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
1
1
1
1
-1
-1
-1
1
1
1
1
1
-1
1
-1
-1
-1
1
1
-1
1
-1
-1
-1
1
-1
-1
1
1

output:

27

result:

ok single line: '27'

Test #84:

score: 15
Accepted
time: 8ms
memory: 3652kb

input:

2
200000
1
-1
1
-1
-1
-1
1
1
1
1
1
1
-1
-1
1
1
1
-1
1
1
1
-1
1
-1
1
1
1
1
-1
-1
1
-1
1
-1
-1
1
1
1
1
1
1
-1
-1
1
-1
1
-1
-1
1
-1
1
-1
1
1
-1
-1
1
-1
1
-1
1
1
-1
1
1
1
1
1
1
-1
-1
-1
-1
1
-1
1
1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
-1
1
-1
-1
-1
1
1
-1
1
-1
-1
-1
-1
1
1
-1
1
-1
1
-1
-1
-1
1
-1
-1
-1
1
1...

output:

49885

result:

ok single line: '49885'

Test #85:

score: 15
Accepted
time: 0ms
memory: 3708kb

input:

2
100
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
1
1
-1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
-1
1
-1
1
1
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

84

result:

ok single line: '84'

Test #86:

score: 15
Accepted
time: 6ms
memory: 3660kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

199987

result:

ok single line: '199987'

Test #87:

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

input:

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

output:

1

result:

ok single line: '1'

Test #88:

score: 15
Accepted
time: 3ms
memory: 5188kb

input:

200000
200000
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
9...

output:

1

result:

ok single line: '1'

Test #89:

score: 15
Accepted
time: 0ms
memory: 3664kb

input:

200000
1
182487

output:

0

result:

ok single line: '0'

Test #90:

score: 15
Accepted
time: 7ms
memory: 3572kb

input:

3
200000
1
2
1
2
2
2
1
1
1
2
2
2
1
2
2
2
2
1
1
2
2
1
2
2
1
2
2
1
2
1
1
2
2
2
2
2
1
2
2
2
1
1
2
1
1
2
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
1
2
1
1
1
2
1
1
2
1
1
1
2
1
1
2
2
2
1
1
1
1
2
1
2
2
1
2
1
2
1
2
1
2
2
2
1
2
2
2
1
1
1
1
2
1
1
2
2
2
2
1
2
1
2
1
1
2
2
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
2
2
2
2
2
2
1
1
1
2
2...

output:

133415

result:

ok single line: '133415'

Test #91:

score: 15
Accepted
time: 7ms
memory: 3656kb

input:

4
200000
3
2
1
3
2
2
2
1
1
1
2
3
3
2
1
1
1
3
1
1
3
3
1
1
3
1
2
2
1
2
1
3
2
2
2
2
1
3
1
1
2
2
3
1
1
3
1
3
1
3
3
2
1
2
3
1
1
1
3
2
1
3
2
2
2
3
1
3
2
3
2
2
3
1
1
3
1
2
2
1
2
1
1
1
1
2
2
1
2
2
1
2
2
1
2
2
3
2
3
2
3
1
3
2
3
2
1
3
3
2
3
3
2
3
3
3
3
3
3
2
3
2
2
1
3
2
3
2
3
2
1
1
2
2
3
2
3
1
1
2
3
2
3
3
2
2...

output:

105734

result:

ok single line: '105734'

Test #92:

score: 15
Accepted
time: 6ms
memory: 3696kb

input:

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

output:

57864

result:

ok single line: '57864'

Test #93:

score: 15
Accepted
time: 8ms
memory: 3628kb

input:

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

output:

31054

result:

ok single line: '31054'

Test #94:

score: 15
Accepted
time: 4ms
memory: 3692kb

input:

203
200000
100
186
4
75
56
130
181
36
161
3
191
32
73
58
164
195
30
33
131
124
53
99
135
140
1
124
29
89
16
34
161
152
54
188
65
43
181
28
83
169
160
47
44
59
145
195
79
27
176
18
179
144
11
195
36
85
169
90
146
93
73
66
11
155
133
63
90
108
107
90
137
65
143
120
154
94
86
202
122
17
56
71
84
179
11...

output:

11485

result:

ok single line: '11485'

Test #95:

score: 15
Accepted
time: 8ms
memory: 3660kb

input:

4000
200000
2985
3407
1143
3560
1007
1855
1639
590
2231
1529
1435
3586
1692
2369
3019
1377
331
3435
1266
2126
2560
3319
295
303
892
360
3487
2092
2712
3029
626
672
228
3846
493
3026
1981
1196
2227
1411
1463
3677
1658
714
630
860
3156
2080
2963
1977
2485
2147
2792
2299
371
1559
2848
2324
3115
851
347...

output:

2483

result:

ok single line: '2483'

Test #96:

score: 15
Accepted
time: 10ms
memory: 3948kb

input:

50000
200000
41213
30997
8619
41861
41316
30105
15006
5065
11015
16985
31909
37042
39467
40487
19883
28554
27460
15459
25824
13158
13066
35584
18001
12362
2818
25831
41729
38972
7193
37946
26803
47535
24225
38582
11225
18966
7044
30591
39076
47171
26818
48011
43377
14636
38329
19199
26087
4199
27793...

output:

708

result:

ok single line: '708'

Test #97:

score: 15
Accepted
time: 15ms
memory: 5252kb

input:

200000
200000
152734
110923
16496
149622
42618
139250
114608
26400
7774
14830
41079
28404
141560
75920
122036
159829
188426
1794
58069
67219
56319
87589
152026
49931
198814
121631
50352
35306
149116
96622
76915
32475
19261
145376
171230
135192
9951
12008
120134
56675
9658
365
164993
86997
101564
463...

output:

355

result:

ok single line: '355'

Test #98:

score: 15
Accepted
time: 13ms
memory: 5176kb

input:

200000
200000
27246
74011
14368
132003
132822
73717
178219
138282
64714
1226
87554
9175
85526
136668
35925
137518
192376
7331
5282
114513
109561
15792
123812
27275
103776
150744
63065
44068
41587
8571
164073
70684
31713
126280
129481
127543
74628
53503
157457
53412
48385
118805
190850
61145
759
6632...

output:

353

result:

ok single line: '353'

Test #99:

score: 15
Accepted
time: 14ms
memory: 5192kb

input:

200000
200000
38946
72672
90488
178872
198147
148517
21120
135564
141486
146690
158535
117398
53985
61630
32324
166488
191602
182605
17450
10007
44955
2832
164706
106964
73485
47865
180127
177432
153405
118096
34895
53548
1579
27202
181777
187006
169313
126798
137850
77449
194252
194736
143109
17519...

output:

371

result:

ok single line: '371'

Test #100:

score: 15
Accepted
time: 0ms
memory: 3712kb

input:

100
100
92
24
44
6
56
47
78
13
79
24
86
40
7
40
3
33
1
63
9
82
73
40
4
92
88
1
9
77
24
27
22
74
55
26
49
99
64
28
20
49
62
11
78
10
69
76
93
96
18
65
20
2
91
4
81
61
41
29
18
3
93
6
31
7
91
58
78
46
56
69
92
46
96
36
22
84
4
8
62
64
61
38
91
2
87
46
27
63
35
55
10
7
74
60
73
45
83
94
40
70

output:

7

result:

ok single line: '7'

Test #101:

score: 15
Accepted
time: 0ms
memory: 3584kb

input:

100
100
26
26
11
16
83
11
16
16
11
26
11
16
11
16
26
16
11
16
99
16
11
26
26
11
16
27
26
11
16
11
11
11
11
16
26
92
16
16
11
26
16
11
26
16
16
26
16
16
11
11
26
16
26
11
11
26
1
11
2
11
11
11
11
16
16
16
26
11
11
80
16
26
16
26
26
11
11
26
16
35
26
26
26
38
11
11
11
16
16
16
26
16
20
11
26
26
16
26
...

output:

46

result:

ok single line: '46'

Test #102:

score: 15
Accepted
time: 11ms
memory: 5176kb

input:

200000
200000
29665
27299
91359
91359
29665
91359
91359
91359
91359
29665
27299
27299
29665
23871
91359
91359
29665
91359
27299
27299
91359
29665
27299
37574
91359
29665
91359
52912
91359
27299
29665
27299
27299
27299
27299
29665
30652
91359
29665
29665
91359
29665
27299
81391
27299
91359
27299
2966...

output:

95191

result:

ok single line: '95191'

Test #103:

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

input:

100
100
66
66
8
8
45
45
97
97
58
58
34
34
71
71
20
69
69
54
54
53
53
43
43
88
88
34
34
76
76
74
74
62
62
42
42
50
50
89
89
66
66
44
44
56
56
96
96
33
33
15
20
15
24
24
12
12
64
64
46
46
21
21
15
15
92
99
99
68
41
87
87
64
64
17
17
73
73
58
44
66
58
92
92
68
68
51
49
49
52
6
49
52
7
7
71
71
50
50
95
95

output:

45

result:

ok single line: '45'

Test #104:

score: 15
Accepted
time: 12ms
memory: 5136kb

input:

200000
200000
48508
48508
192753
192753
128554
128554
9725
9725
81029
81029
24266
24266
94313
94313
153565
153565
64878
64878
24712
24712
50046
50046
196752
196752
140257
140257
72031
72031
180537
180537
68161
68161
30314
30314
179259
179259
162787
162787
11787
11787
21698
21698
179267
179267
154017...

output:

99995

result:

ok single line: '99995'

Test #105:

score: 15
Accepted
time: 0ms
memory: 3712kb

input:

100
100
-14
29
-84
-95
83
83
90
-29
5
1
22
-32
23
-53
38
89
53
-46
-69
-69
-60
-40
-33
-91
-81
3
55
47
5
42
31
-58
-98
-49
74
-29
3
-92
-17
81
58
54
-24
14
82
98
33
43
-66
-6
16
14
26
-19
-57
-51
-86
30
-62
34
-23
-25
10
-45
5
25
-60
-89
7
6
-77
-30
-47
-99
-73
80
-59
85
-94
14
-86
-70
63
-58
87
32
...

output:

4

result:

ok single line: '4'

Test #106:

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

input:

100
100
35
-91
-76
62
-76
51
-71
-19
-44
-76
86
84
88
13
-25
-76
38
-97
23
-77
-80
-56
68
56
-3
79
17
22
-64
54
-90
20
84
4
15
-7
-23
-35
73
85
-33
50
-85
-72
84
-94
48
-84
-67
-71
-69
-57
-47
10
-58
22
26
51
-53
-77
-29
-91
5
66
21
-85
45
-37
91
2
-19
78
56
22
21
49
-5
-26
-73
12
-50
36
24
-64
-91
...

output:

3

result:

ok single line: '3'

Test #107:

score: 15
Accepted
time: 0ms
memory: 3716kb

input:

100
100
-99
-63
-4
-16
-7
-49
-41
-55
-70
-11
-65
-42
-98
-85
-25
-52
-30
-72
98
-79
99
70
-73
-53
-93
-46
-2
-19
19
2
4
-59
-90
-82
90
-40
-18
-34
-4
-87
85
82
46
-67
-36
-19
52
-35
-37
-31
-96
49
-28
-15
-99
-52
-71
-88
-95
-90
-12
37
72
19
-2
-94
-85
-54
-20
11
88
25
96
-43
-83
-48
7
-25
59
95
-9...

output:

0

result:

ok single line: '0'

Test #108:

score: 15
Accepted
time: 0ms
memory: 3636kb

input:

100
100
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
8...

output:

0

result:

ok single line: '0'

Test #109:

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

input:

100
100
71
71
-77
71
-71
81
-71
71
-71
77
77
-77
-71
-71
-71
-24
77
71
51
-71
22
71
71
77
77
-71
-71
23
71
-71
71
-7
77
-77
-50
71
77
64
-77
-71
71
71
71
77
77
-77
-42
-77
-77
71
71
-71
71
-71
71
77
56
-71
71
-77
71
71
-71
71
71
77
77
71
10
-71
71
71
71
77
-71
12
71
-77
-71
71
71
-71
-77
-71
-71
-71...

output:

21

result:

ok single line: '21'

Test #110:

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

input:

100
100
-45
-68
-7
-1
-82
-22
-89
-7
-20
-50
-38
-79
-9
-87
-11
-35
-61
-45
-24
-95
-43
-39
-81
-92
-62
-81
-70
-91
-7
-73
-45
-26
-22
-76
-27
-46
-51
-42
-17
-11
-11
-95
-50
-79
-18
-34
-56
-3
-21
-93
-71
-49
-51
-7
-75
-84
-65
-25
-17
-56
-43
-17
-88
-29
-44
-60
-41
-80
-78
-30
-78
-96
-46
-82
-31...

output:

0

result:

ok single line: '0'

Test #111:

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

input:

100
100
11
11
24
24
67
67
97
97
17
17
28
28
29
29
71
71
24
24
41
41
64
64
18
-70
18
10
10
24
24
52
52
7
7
87
87
85
85
89
89
69
76
69
13
21
21
45
45
2
2
-60
25
25
61
61
33
33
41
41
65
65
94
94
82
82
38
-79
24
38
-23
20
-3
20
17
17
73
73
47
47
90
90
65
65
7
7
98
98
57
57
15
15
8
16
8
14
14
88
88
50
50...

output:

45

result:

ok single line: '45'

Test #112:

score: 0
Runtime Error

input:

200000
200000
-163773
-113711
-57085
-23082
-7930
-67839
-93074
-94004
-8071
-3370
-144880
-181823
-121715
-19686
-44422
-53503
-23988
-136598
-137400
-152784
-172599
-159593
-17915
-86572
-168171
-4609
-10782
-160237
-81718
-140322
-164345
-184840
-143664
-23637
-106357
-36649
-48084
-63436
-77979
...

output:


result: