QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#233878#2274. DiversityGMBox100 ✓1086ms9952kbC++173.5kb2023-11-01 04:45:372023-11-01 04:45:37

详细

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 1ms
memory: 5684kb

input:

11 1
1 1 1 1 1 1 1 1 1 1 1
1 11

output:

66

result:

ok single line: '66'

Test #2:

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

input:

11 1
1 1 2 2 1 1 1 1 1 1 1
1 11

output:

84

result:

ok single line: '84'

Test #3:

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

input:

11 1
1 1 3 1 1 3 1 3 3 3 2
1 11

output:

106

result:

ok single line: '106'

Test #4:

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

input:

11 1
3 3 1 2 1 4 2 1 3 2 3
1 11

output:

128

result:

ok single line: '128'

Test #5:

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

input:

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

output:

148

result:

ok single line: '148'

Test #6:

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

input:

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

output:

178

result:

ok single line: '178'

Test #7:

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

input:

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

output:

204

result:

ok single line: '204'

Test #8:

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

input:

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

output:

228

result:

ok single line: '228'

Test #9:

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

input:

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

output:

256

result:

ok single line: '256'

Test #10:

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

input:

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

output:

286

result:

ok single line: '286'

Subtask #2:

score: 10
Accepted

Test #11:

score: 10
Accepted
time: 1ms
memory: 7664kb

input:

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

output:

9086

result:

ok single line: '9086'

Test #12:

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

input:

1000 1
7 1 5 7 1 7 5 5 7 7 1 1 7 5 5 4 1 7 7 5 7 4 6 5 5 5 1 5 5 7 1 5 5 1 5 4 5 5 5 7 3 5 5 5 7 4 7 1 7 7 5 7 7 4 1 1 4 7 5 7 5 7 5 5 5 3 1 3 1 7 5 5 5 4 5 5 3 1 1 5 7 5 5 6 5 7 5 2 5 4 5 5 5 5 5 3 5 5 5 5 7 5 5 5 7 5 3 5 3 3 3 1 3 5 7 5 5 5 7 7 7 1 4 1 3 7 7 5 5 4 3 1 7 7 7 4 7 1 5 1 3 7 5 5 5 5 7...

output:

1080336

result:

ok single line: '1080336'

Test #13:

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

input:

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

output:

130776852

result:

ok single line: '130776852'

Test #14:

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

input:

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

output:

15967754766

result:

ok single line: '15967754766'

Test #15:

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

input:

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

output:

56305026101

result:

ok single line: '56305026101'

Test #16:

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

input:

300000 1
5 5 9 11 10 7 8 7 9 3 9 1 10 11 11 9 11 3 9 8 10 9 1 9 9 9 9 10 7 8 7 9 11 10 3 7 11 3 9 8 9 1 11 8 11 8 10 3 7 3 7 3 9 9 3 3 11 11 9 11 7 1 9 3 8 10 7 11 7 9 9 9 3 10 7 7 3 10 3 11 3 3 7 1 7 9 8 9 8 7 10 9 3 8 7 11 11 9 8 11 11 5 7 11 1 11 9 9 10 11 10 11 11 7 3 9 7 10 9 7 5 10 9 3 9 7 11 ...

output:

139948466774

result:

ok single line: '139948466774'

Test #17:

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

input:

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

output:

114037502263

result:

ok single line: '114037502263'

Test #18:

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

input:

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

output:

152775877538

result:

ok single line: '152775877538'

Test #19:

score: 0
Accepted
time: 11ms
memory: 7608kb

input:

300000 1
8 3 3 7 8 4 1 8 8 8 4 8 7 10 9 4 7 7 3 7 7 7 3 8 4 10 6 4 9 7 9 3 7 7 7 8 10 6 6 7 3 4 10 8 4 9 6 3 3 3 7 8 3 8 3 6 8 9 4 6 4 10 8 4 6 3 6 10 4 6 4 7 3 3 1 11 6 7 6 8 4 7 8 8 11 10 3 7 8 8 3 7 3 10 10 7 7 3 8 3 4 4 3 6 10 10 7 4 3 10 11 9 7 10 6 4 9 4 10 8 1 9 5 7 10 7 8 1 6 6 9 4 10 7 8 10...

output:

151532187033

result:

ok single line: '151532187033'

Test #20:

score: 0
Accepted
time: 12ms
memory: 9812kb

input:

300000 1
3 7 3 5 3 5 10 11 10 10 7 8 4 7 7 3 3 10 11 3 8 3 5 3 1 11 10 10 3 5 7 5 3 10 3 3 3 5 5 8 3 3 11 3 3 3 3 5 5 3 3 3 10 8 3 3 5 11 5 7 3 7 3 5 5 3 5 5 11 8 8 3 10 3 5 10 7 10 7 11 8 8 11 3 3 10 8 3 10 11 5 5 11 3 10 3 3 3 10 5 5 8 11 11 1 5 3 10 5 5 5 8 5 3 10 10 3 8 10 10 3 2 8 8 8 5 8 8 3 3...

output:

119754787872

result:

ok single line: '119754787872'

Test #21:

score: 0
Accepted
time: 12ms
memory: 9540kb

input:

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

output:

143416736426

result:

ok single line: '143416736426'

Test #22:

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

input:

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

output:

149325579430

result:

ok single line: '149325579430'

Test #23:

score: 0
Accepted
time: 12ms
memory: 9624kb

input:

300000 1
8 5 7 11 3 10 8 11 7 2 4 11 5 2 5 3 3 6 6 4 1 2 5 2 7 11 7 5 7 11 3 11 5 3 2 11 11 11 3 11 11 3 4 4 3 3 6 5 2 2 6 6 7 2 6 5 11 7 3 11 2 5 2 6 8 3 3 6 11 11 5 6 11 11 5 11 8 4 4 7 4 4 6 4 3 8 11 4 5 3 5 6 4 5 3 6 11 6 2 7 5 11 6 11 2 3 6 7 2 6 1 6 4 6 6 6 5 11 6 7 4 6 3 6 10 4 5 6 3 10 11 3 ...

output:

150275511546

result:

ok single line: '150275511546'

Test #24:

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

input:

300000 1
9 3 4 6 2 8 4 8 4 11 9 8 2 9 9 2 9 2 2 6 2 11 11 6 8 2 8 9 2 9 11 4 4 8 3 8 9 2 6 3 11 7 4 4 11 6 6 4 4 11 11 11 4 6 8 8 3 4 11 11 11 6 5 8 2 2 9 9 8 2 6 3 8 11 4 3 3 11 11 11 4 2 2 3 11 2 11 8 8 6 5 8 8 8 6 2 8 8 3 6 8 11 3 6 3 4 3 6 8 4 2 2 4 2 4 11 6 2 4 2 3 2 11 8 4 4 8 4 3 7 4 9 4 11 1...

output:

139250426662

result:

ok single line: '139250426662'

Test #25:

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

input:

300000 1
6 5 5 8 8 8 3 11 4 8 6 6 5 5 11 8 11 4 5 8 5 5 8 11 6 6 8 5 3 10 5 11 3 3 5 5 8 6 4 11 11 5 6 11 6 3 8 3 6 8 5 8 6 6 10 6 6 10 8 8 6 5 5 5 6 10 11 5 8 8 6 8 3 6 5 6 5 6 3 11 3 3 11 8 6 11 2 8 6 8 8 8 3 6 3 6 8 11 11 8 1 3 8 11 4 5 10 6 1 8 5 8 3 5 3 10 2 8 5 8 8 4 1 4 3 5 5 4 10 11 8 6 8 10...

output:

141068767410

result:

ok single line: '141068767410'

Subtask #3:

score: 8
Accepted

Test #26:

score: 8
Accepted
time: 1ms
memory: 7724kb

input:

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

output:

15675

result:

ok single line: '15675'

Test #27:

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

input:

1000 1
1 15 10 3 11 3 3 1 5 6 1 5 12 5 9 8 9 1 1 1 6 1 2 5 11 10 2 6 1 11 6 11 6 9 12 1 5 10 11 13 6 13 6 11 9 6 10 5 13 15 9 10 12 2 11 3 8 10 6 10 3 5 10 12 1 11 6 9 11 9 9 6 12 3 10 8 1 11 10 9 6 6 12 8 1 8 11 14 13 12 12 12 1 10 1 15 6 2 3 6 9 13 10 6 1 6 2 9 13 8 11 9 11 12 12 9 15 1 6 10 13 8 ...

output:

2057001

result:

ok single line: '2057001'

Test #28:

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

input:

10000 1
9 13 11 14 14 11 6 10 9 1 4 4 4 4 9 12 17 8 17 13 9 14 8 17 4 9 4 8 13 9 5 10 13 9 12 13 9 6 16 8 12 6 12 14 4 6 6 10 14 4 13 15 12 17 14 14 8 9 11 10 4 13 17 12 2 4 14 10 9 13 17 4 17 10 13 9 15 13 17 6 13 13 6 4 14 17 10 10 4 8 6 4 10 10 9 10 8 4 7 5 13 14 4 4 10 4 6 4 10 13 17 4 8 10 14 6...

output:

223061162

result:

ok single line: '223061162'

Test #29:

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

input:

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

output:

23275663319

result:

ok single line: '23275663319'

Test #30:

score: 0
Accepted
time: 9ms
memory: 8500kb

input:

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

output:

99469638226

result:

ok single line: '99469638226'

Test #31:

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

input:

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

output:

239888985830

result:

ok single line: '239888985830'

Test #32:

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

input:

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

output:

254115737392

result:

ok single line: '254115737392'

Test #33:

score: 0
Accepted
time: 13ms
memory: 7612kb

input:

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

output:

242409516161

result:

ok single line: '242409516161'

Test #34:

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

input:

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

output:

238551673749

result:

ok single line: '238551673749'

Test #35:

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

input:

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

output:

263771344513

result:

ok single line: '263771344513'

Test #36:

score: 0
Accepted
time: 14ms
memory: 9628kb

input:

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

output:

281363200376

result:

ok single line: '281363200376'

Test #37:

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

input:

300000 1
17 10 7 21 21 9 23 19 19 2 21 3 15 15 19 9 19 11 21 15 19 10 19 15 21 9 3 15 21 19 16 19 19 10 23 23 15 4 8 1 10 8 23 15 9 10 17 21 23 17 7 2 15 8 8 17 15 4 8 19 19 15 19 21 20 4 23 8 15 22 10 4 7 22 4 21 4 19 4 23 4 4 23 9 11 11 11 3 15 21 4 19 9 9 23 17 10 16 17 7 9 9 23 23 21 4 15 23 11 ...

output:

229586229253

result:

ok single line: '229586229253'

Test #38:

score: 0
Accepted
time: 13ms
memory: 9532kb

input:

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

output:

219584486506

result:

ok single line: '219584486506'

Test #39:

score: 0
Accepted
time: 13ms
memory: 7740kb

input:

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

output:

223771416503

result:

ok single line: '223771416503'

Test #40:

score: 0
Accepted
time: 14ms
memory: 7812kb

input:

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

output:

280674255355

result:

ok single line: '280674255355'

Subtask #4:

score: 16
Accepted

Test #41:

score: 16
Accepted
time: 1ms
memory: 5856kb

input:

1000 1
38 42 18 41 39 21 6 5 31 7 42 38 11 12 43 43 44 42 3 45 7 5 1 21 48 38 31 1 11 37 2 29 23 21 4 1 36 29 37 36 9 1 49 12 2 35 33 8 31 29 38 7 45 34 39 19 1 21 41 21 21 42 37 18 21 36 21 31 5 29 7 42 43 38 5 9 2 17 3 24 37 38 17 37 12 19 24 18 43 34 12 26 43 1 37 36 21 38 2 3 24 17 10 21 1 34 37...

output:

5248890

result:

ok single line: '5248890'

Test #42:

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

input:

1000 1
84 94 61 99 20 95 97 14 8 68 90 21 65 36 16 14 66 8 96 15 14 84 75 80 92 14 94 16 82 59 67 42 59 16 2 15 100 95 99 16 28 56 66 56 8 28 86 70 5 31 40 77 22 72 89 72 56 99 68 40 28 65 42 57 59 40 85 86 7 46 79 13 85 8 61 22 99 52 77 74 96 10 46 4 40 88 5 27 64 40 67 46 56 35 59 54 68 40 80 2 91...

output:

10733900

result:

ok single line: '10733900'

Test #43:

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

input:

1000 1
86 209 219 118 69 142 221 234 214 136 184 201 134 248 67 170 229 194 228 31 15 126 7 159 182 144 57 182 215 186 48 160 218 225 6 95 1 57 199 236 112 3 202 85 198 5 104 114 238 52 178 236 222 194 34 101 51 194 36 149 173 122 109 222 85 53 87 141 171 198 47 104 129 182 136 195 183 133 137 147 1...

output:

26597131

result:

ok single line: '26597131'

Test #44:

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

input:

10000 1
19 99 55 1 32 74 1 62 92 42 18 53 72 14 70 2 47 41 97 41 11 31 1 97 39 41 24 75 88 64 62 98 42 39 24 65 23 42 14 10 74 95 75 89 62 16 42 68 97 66 94 5 42 26 74 75 95 96 57 97 70 96 11 88 34 11 18 77 74 42 19 30 65 65 65 88 35 12 68 88 14 16 99 47 82 12 16 96 90 46 41 97 14 14 32 3 1 96 1 64 ...

output:

905104281

result:

ok single line: '905104281'

Test #45:

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

input:

10000 1
96 43 58 169 201 145 45 244 217 105 233 139 30 167 74 116 128 108 3 249 250 35 101 111 191 111 176 56 229 135 116 76 6 170 144 196 33 249 3 6 115 28 180 47 45 170 40 140 17 181 116 195 125 14 78 81 183 239 154 201 239 180 136 154 225 186 163 140 101 33 34 179 161 61 226 76 43 15 79 186 248 9...

output:

2402314626

result:

ok single line: '2402314626'

Test #46:

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

input:

10000 1
921 213 443 854 958 320 492 612 164 587 25 143 552 404 693 173 285 360 937 928 706 251 40 775 307 127 814 325 661 969 668 340 756 716 773 81 206 722 774 909 106 168 803 575 111 414 809 684 426 364 80 418 405 82 208 994 57 278 587 206 740 953 417 294 414 471 154 428 418 298 129 17 409 668 692...

output:

10101157786

result:

ok single line: '10101157786'

Test #47:

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

input:

50000 1
450 159 238 45 437 336 414 19 395 127 126 111 474 445 103 5 392 303 221 72 2 394 220 87 396 429 112 375 305 458 386 113 318 490 305 440 232 169 356 474 467 33 77 437 64 26 494 294 261 108 315 394 188 239 135 359 62 458 181 432 28 142 437 118 432 249 368 98 330 282 371 86 167 182 465 469 251 ...

output:

114992305105

result:

ok single line: '114992305105'

Test #48:

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

input:

50000 1
257 927 445 418 44 248 515 161 441 488 44 500 357 786 399 843 557 9 51 577 735 533 741 430 567 560 430 714 73 44 356 24 86 130 730 828 547 54 904 732 616 241 430 441 595 689 32 18 792 46 868 328 986 947 528 156 40 703 93 919 960 826 553 791 263 517 32 372 848 44 504 533 421 773 136 424 237 6...

output:

237081881190

result:

ok single line: '237081881190'

Test #49:

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

input:

100000 1
315 909 350 552 60 904 611 471 284 665 112 658 133 302 528 600 94 260 37 127 607 857 637 326 203 892 178 205 478 311 56 79 910 438 43 968 212 296 145 992 727 211 611 600 832 818 272 392 790 172 269 311 685 583 340 456 550 815 649 78 211 879 547 8 991 844 331 818 338 722 785 750 109 869 157 ...

output:

948384729806

result:

ok single line: '948384729806'

Test #50:

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

input:

200000 1
962 825 891 575 126 258 979 868 213 436 929 328 501 479 684 966 718 787 977 843 666 608 391 200 867 958 783 685 398 381 711 648 841 147 353 541 239 581 409 97 962 254 304 639 407 315 82 537 985 945 898 21 430 676 620 73 341 691 349 469 958 724 914 71 400 412 266 14 55 715 735 113 786 94 256...

output:

3766958229213

result:

ok single line: '3766958229213'

Test #51:

score: 0
Accepted
time: 14ms
memory: 7836kb

input:

300000 1
901 815 89 749 381 291 657 852 127 663 649 710 67 822 538 45 619 522 737 344 453 827 999 189 948 412 660 273 151 329 904 69 286 334 691 314 216 31 971 330 574 719 223 524 602 545 316 974 230 703 881 658 31 867 18 497 483 740 863 366 94 569 501 325 781 236 80 407 822 518 931 49 263 523 742 1...

output:

8488793094773

result:

ok single line: '8488793094773'

Test #52:

score: 0
Accepted
time: 14ms
memory: 6256kb

input:

300000 1
942 933 145 367 199 970 761 241 431 316 331 247 649 944 457 613 953 430 809 961 878 502 264 80 810 506 514 115 619 785 556 600 10 438 433 926 2 155 952 593 638 764 222 57 174 175 340 564 438 926 411 567 240 878 952 966 411 593 749 95 272 671 65 659 50 763 772 560 871 361 582 560 343 418 955...

output:

8456833169986

result:

ok single line: '8456833169986'

Test #53:

score: 0
Accepted
time: 13ms
memory: 5964kb

input:

300000 1
369 313 93 849 40 216 678 801 903 611 176 313 940 883 84 418 178 958 882 119 58 431 268 578 237 400 841 964 202 775 640 532 48 332 366 627 940 157 889 229 403 39 746 733 106 449 712 289 889 277 201 60 84 863 128 227 333 906 789 152 445 218 735 93 190 400 84 147 733 851 284 358 746 490 772 1...

output:

8244301869676

result:

ok single line: '8244301869676'

Test #54:

score: 0
Accepted
time: 14ms
memory: 7920kb

input:

300000 1
298 129 987 589 958 580 851 787 360 376 811 953 230 537 836 962 276 496 161 442 560 433 961 501 8 493 480 379 580 815 351 311 48 699 667 613 478 420 834 342 941 432 474 757 908 955 631 279 860 73 8 110 561 628 873 600 527 82 847 628 680 489 94 312 433 594 918 700 413 569 329 395 622 72 816 ...

output:

8427328554301

result:

ok single line: '8427328554301'

Test #55:

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

input:

300000 1
431 60 442 668 682 370 423 607 669 782 171 626 60 376 548 776 146 484 260 788 291 565 415 934 823 400 300 29 460 870 542 214 217 546 964 332 570 510 34 152 45 88 82 657 333 289 407 745 389 900 859 694 660 589 530 150 854 905 341 712 280 239 488 731 530 859 195 192 819 754 228 669 876 910 80...

output:

8378199606404

result:

ok single line: '8378199606404'

Test #56:

score: 0
Accepted
time: 9ms
memory: 5808kb

input:

300000 1
466 195 917 467 382 984 305 225 580 350 137 447 155 728 34 396 621 132 154 621 737 518 716 276 988 657 189 327 450 796 394 939 379 568 436 768 589 418 382 147 116 620 599 305 122 676 551 781 28 198 42 985 131 867 225 226 181 24 323 891 18 336 742 66 155 88 923 724 726 917 458 37 935 556 536...

output:

8502269369836

result:

ok single line: '8502269369836'

Test #57:

score: 0
Accepted
time: 13ms
memory: 7928kb

input:

300000 1
440 139 676 676 161 467 452 373 21 244 152 15 985 912 985 465 448 154 495 104 677 187 545 360 405 717 631 455 132 529 804 289 660 424 161 827 133 830 953 129 905 492 510 106 62 254 988 145 834 37 235 466 930 296 73 765 573 151 700 434 868 681 372 246 152 727 464 33 86 716 744 666 569 893 58...

output:

8507869023080

result:

ok single line: '8507869023080'

Test #58:

score: 0
Accepted
time: 14ms
memory: 7840kb

input:

300000 1
210 924 423 443 473 462 217 903 156 715 977 450 801 540 3 537 539 855 811 352 627 694 189 902 603 656 278 556 70 706 548 98 391 849 696 351 483 365 430 321 514 51 594 536 265 421 574 314 906 655 787 206 5 539 269 724 947 746 151 505 55 952 494 944 685 127 59 734 304 790 795 967 784 457 97 3...

output:

8359452478741

result:

ok single line: '8359452478741'

Test #59:

score: 0
Accepted
time: 13ms
memory: 6180kb

input:

300000 1
429 852 568 847 209 989 87 39 250 418 887 470 553 276 575 774 343 885 498 976 854 760 510 357 918 260 845 965 980 72 888 899 453 454 933 321 364 618 426 142 493 42 219 822 238 658 708 945 121 687 760 185 327 468 428 869 303 410 34 952 209 646 142 333 182 54 576 493 477 15 433 770 296 99 454...

output:

8564572526075

result:

ok single line: '8564572526075'

Test #60:

score: 0
Accepted
time: 14ms
memory: 8028kb

input:

300000 1
361 529 556 323 654 698 711 539 247 643 430 964 396 696 715 185 617 71 155 660 808 862 786 435 516 16 847 487 268 317 21 342 915 312 606 467 88 928 467 642 496 992 444 59 531 724 668 317 415 15 668 970 317 391 406 993 731 313 127 554 960 88 487 567 810 668 900 112 21 88 124 607 590 3 974 73...

output:

8245734180054

result:

ok single line: '8245734180054'

Test #61:

score: 0
Accepted
time: 14ms
memory: 6028kb

input:

300000 1
913 433 66 778 971 863 954 346 915 90 53 684 654 98 404 217 459 68 704 328 213 210 934 8 480 365 456 762 256 244 722 767 991 548 804 714 139 695 439 535 342 777 284 851 515 850 393 431 925 548 654 159 960 553 341 646 927 604 947 851 780 404 722 419 393 413 481 829 818 701 814 829 907 357 93...

output:

8465219775685

result:

ok single line: '8465219775685'

Test #62:

score: 0
Accepted
time: 13ms
memory: 6184kb

input:

300000 1
112 857 302 456 377 261 65 992 455 85 760 881 320 614 921 593 254 725 341 277 922 997 252 168 166 543 562 426 268 783 660 406 803 505 155 924 707 806 350 993 779 28 599 158 551 747 842 656 726 36 851 591 223 916 87 610 399 161 872 106 850 372 281 333 348 599 722 335 52 719 567 825 344 602 7...

output:

8430602717582

result:

ok single line: '8430602717582'

Test #63:

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

input:

300000 1
446 544 64 614 473 498 17 562 451 439 390 516 711 507 477 767 209 608 345 405 199 703 192 597 805 768 108 915 507 745 550 23 871 694 863 410 260 486 459 903 507 949 215 927 515 851 820 124 289 589 713 692 47 446 584 241 690 220 192 10 226 656 440 906 181 64 269 266 692 412 236 879 564 446 3...

output:

8269261910969

result:

ok single line: '8269261910969'

Test #64:

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

input:

300000 1
240 625 849 708 672 783 714 191 735 406 721 454 181 429 729 99 939 847 495 294 489 670 266 107 615 539 161 611 852 962 480 355 537 454 792 525 699 989 605 125 794 826 803 394 499 806 553 538 518 729 3 602 314 485 754 307 953 287 637 887 627 760 969 132 773 808 443 995 986 783 408 373 227 51...

output:

8291237686188

result:

ok single line: '8291237686188'

Test #65:

score: 0
Accepted
time: 13ms
memory: 7864kb

input:

300000 1
623 406 961 588 658 783 329 180 926 574 269 154 647 252 322 100 391 268 94 998 786 792 599 252 180 912 273 526 663 353 833 848 955 515 801 228 647 881 378 294 833 263 334 912 225 219 903 351 44 625 596 420 423 546 434 647 865 426 712 850 97 726 870 852 390 898 383 576 741 462 639 626 730 36...

output:

8410884952255

result:

ok single line: '8410884952255'

Test #66:

score: 0
Accepted
time: 13ms
memory: 7932kb

input:

300000 1
226 989 21 215 350 209 98 290 552 274 683 51 991 100 979 290 668 754 968 204 878 50 138 749 586 669 889 219 248 896 700 939 438 76 209 483 7 687 325 442 933 597 820 94 410 368 761 51 934 531 905 598 36 890 800 98 224 622 951 508 481 339 177 281 201 980 241 290 693 342 146 106 347 724 876 95...

output:

8491235280766

result:

ok single line: '8491235280766'

Test #67:

score: 0
Accepted
time: 14ms
memory: 6332kb

input:

300000 1
972 626 205 704 380 103 621 149 466 665 464 536 251 25 449 703 230 194 665 377 746 567 843 188 132 987 557 510 771 605 163 403 486 161 133 292 293 683 606 677 755 132 510 5 703 130 99 443 636 681 960 51 548 985 301 758 263 208 881 921 755 534 326 104 881 755 26 987 967 985 574 369 202 279 1...

output:

8642213558494

result:

ok single line: '8642213558494'

Test #68:

score: 0
Accepted
time: 14ms
memory: 8028kb

input:

300000 1
84 52 870 264 354 994 620 218 691 126 870 442 847 102 593 451 229 622 195 131 213 136 219 916 92 373 38 52 490 74 94 511 558 268 946 283 543 198 145 948 671 635 194 197 167 357 205 524 620 558 118 743 944 527 143 536 960 707 250 745 36 932 945 485 326 301 66 331 870 427 589 166 760 542 390 ...

output:

8290009452607

result:

ok single line: '8290009452607'

Test #69:

score: 0
Accepted
time: 14ms
memory: 7852kb

input:

300000 1
733 553 147 223 737 511 639 656 93 935 626 603 218 468 49 287 996 253 442 614 385 692 418 85 608 785 850 818 964 718 75 358 423 854 593 232 663 118 302 642 854 414 114 659 743 209 133 899 760 301 699 767 527 880 904 206 911 250 71 368 441 90 779 362 168 701 692 71 716 513 306 511 507 610 98...

output:

8349544583321

result:

ok single line: '8349544583321'

Test #70:

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

input:

300000 1
89 166 554 346 570 733 182 547 204 952 875 830 23 757 859 98 166 315 118 935 467 292 471 31 796 10 796 807 215 307 588 216 762 909 963 588 924 680 317 303 248 736 49 376 670 560 600 12 202 141 230 466 508 243 202 775 127 918 32 589 733 224 731 385 136 775 683 516 932 224 176 355 199 446 670...

output:

8435235112006

result:

ok single line: '8435235112006'

Subtask #5:

score: 26
Accepted

Test #71:

score: 26
Accepted
time: 3ms
memory: 7736kb

input:

50000 1
968 1738 1078 1932 1675 1435 968 1630 1507 185 844 234 595 272 966 1112 1432 1414 439 943 830 340 1760 177 1068 1990 258 1892 1646 641 527 483 1620 1967 1184 341 590 452 1024 552 1218 1355 375 419 799 24 444 1496 1232 651 760 1025 968 307 1240 648 1268 1715 1612 1723 1497 1078 1355 803 1371 ...

output:

476921296943

result:

ok single line: '476921296943'

Test #72:

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

input:

50000 1
1746 1358 1607 692 1434 1651 819 972 216 224 340 1462 1951 201 317 1720 833 1798 534 985 1840 445 654 1525 1175 1896 468 468 1569 430 1725 1528 1421 1380 1512 828 1836 213 1488 634 1567 445 1983 1631 1434 1435 1439 827 440 1687 1354 1362 187 1037 1056 1404 39 640 121 1261 764 1994 1045 599 1...

output:

472100254752

result:

ok single line: '472100254752'

Test #73:

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

input:

50000 1
1114 32 824 1317 1434 761 412 688 193 1705 425 1562 383 760 1643 1200 961 963 1932 214 817 1682 217 860 518 1237 932 733 151 431 590 1784 1636 887 1245 808 731 1991 1983 1478 1769 1641 1059 1384 1547 1616 505 1479 118 850 229 436 1768 1902 1286 373 15 1838 696 1676 674 1321 1863 636 1706 126...

output:

465579268857

result:

ok single line: '465579268857'

Test #74:

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

input:

50000 1
787 93 265 1520 1620 2 1941 224 603 948 243 1559 342 295 1532 1014 1609 1820 1743 430 1334 1572 169 477 846 1405 1767 749 219 243 919 1768 1781 985 495 984 1917 1189 1532 1318 787 1132 492 655 450 256 917 453 603 1249 90 1694 1886 905 176 1225 1227 605 1998 450 1355 372 699 227 1349 1446 168...

output:

480988471525

result:

ok single line: '480988471525'

Test #75:

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

input:

50000 1
832 1518 898 770 1340 1492 434 1948 1873 1891 991 101 459 762 740 123 1295 1178 1299 443 1789 1340 1859 131 1657 1249 977 268 834 850 1732 786 998 1250 229 1676 489 1390 1518 1543 1702 1990 1643 124 883 349 1474 1294 1440 1334 84 44 678 149 1510 117 874 1288 135 1563 1052 1701 221 444 1679 1...

output:

468422277379

result:

ok single line: '468422277379'

Test #76:

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

input:

100000 1
1890 915 108 2372 888 1545 2942 3431 4334 3573 896 2720 4090 4103 3247 1714 892 829 3339 644 744 3888 2057 594 671 333 4650 3043 50 2976 3936 1731 3392 1231 1715 3206 3153 2771 4717 1527 4103 1204 1976 3936 3862 2891 2047 4354 1136 1278 1151 3548 2181 1364 1470 4103 1682 1281 3766 2498 2969...

output:

4688636369650

result:

ok single line: '4688636369650'

Test #77:

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

input:

100000 1
3588 920 362 4819 3520 1065 4222 4770 4573 1361 616 3823 3815 1268 4998 1388 2826 3017 1235 1512 1496 475 4423 3238 4450 3028 4365 2199 3271 801 1176 2208 2634 3878 2773 3474 2675 4287 2605 698 1791 1732 2576 4588 1027 2830 543 4943 4562 2351 1904 3565 79 4503 4442 3659 3769 3580 4000 1855 ...

output:

4785872171345

result:

ok single line: '4785872171345'

Test #78:

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

input:

100000 1
2988 3594 232 1035 2934 1603 772 1040 2654 4377 3443 2463 3376 1121 3840 4479 93 1520 4295 2577 1318 430 3113 3315 1174 3719 1634 1376 4959 1534 838 1153 2356 1885 3924 472 4227 2134 1588 830 3838 3139 2296 2943 2236 3896 554 1538 4273 3281 1736 1789 915 2398 4015 3996 2929 2951 3671 452 15...

output:

4810863933745

result:

ok single line: '4810863933745'

Test #79:

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

input:

100000 1
1952 2348 2132 1326 1031 2006 1712 411 3103 1081 1037 3482 3289 625 4074 1711 1575 3392 1486 3914 2767 297 4602 2987 2232 4961 2843 1807 4679 2004 910 661 2308 1171 2302 51 3329 2352 774 3769 3719 3901 4984 2952 189 4979 1696 75 2145 2698 2888 3831 4096 4111 1956 3799 3362 181 824 2534 139 ...

output:

4845347827528

result:

ok single line: '4845347827528'

Test #80:

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

input:

100000 1
2015 4712 3201 3509 885 4353 1048 2850 3787 3441 4203 3103 84 3588 4584 1642 3618 3575 3364 3092 1585 1216 2747 3991 4806 663 2436 1160 3031 510 4757 561 3953 742 1554 921 1005 3732 1884 112 1947 1891 3242 4465 1508 2943 2033 2958 1712 1346 4473 2831 1490 3819 3554 1696 4133 2810 2762 1761 ...

output:

4788822381921

result:

ok single line: '4788822381921'

Test #81:

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

input:

200000 1
8133 1241 9238 7807 6566 3982 7604 9874 5470 9930 9053 3400 6914 2777 9723 1517 6952 2879 2263 1464 8513 876 6371 2104 3657 3645 9725 9008 8814 6587 7116 8348 5552 1460 19 7727 2188 3369 270 5112 41 6898 1644 6233 9833 3108 3911 6355 3640 6749 7510 1852 1434 3365 8272 2120 6452 1362 220 476...

output:

37987869178143

result:

ok single line: '37987869178143'

Test #82:

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

input:

200000 1
2302 6055 6892 3668 4668 8070 522 2930 1551 3154 745 5090 3225 8597 7049 4618 6393 2140 5026 7437 4749 3440 5963 781 6179 1740 5775 6678 2671 6178 1295 8460 8904 7068 6344 3776 7927 7484 4364 2902 6219 6403 4282 6740 186 1125 5641 809 4575 3489 7336 3663 2965 9656 4563 6018 6738 5961 7629 8...

output:

38091009323182

result:

ok single line: '38091009323182'

Test #83:

score: 0
Accepted
time: 9ms
memory: 7740kb

input:

200000 1
9333 5690 2441 1125 929 2854 969 7207 3269 8827 2579 8357 2959 166 714 431 2884 6190 4411 7747 8275 8860 5461 1311 3539 4638 3628 1659 4478 5775 8181 4889 8528 8671 7755 8359 7384 8527 6600 426 4061 3900 3867 7880 1560 3513 7469 7886 886 6799 4499 5397 9362 8241 3711 9000 8916 1058 1974 518...

output:

37961643792428

result:

ok single line: '37961643792428'

Test #84:

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

input:

200000 1
8117 5354 1627 2071 519 5989 6245 4905 2137 1072 6800 5870 7060 9556 592 4176 5647 1089 8456 7073 6327 7647 6154 7059 9637 5835 3308 7821 7920 7334 5757 9497 6038 1028 6958 3161 2816 3044 2076 4688 5339 4165 3248 202 9518 4049 7007 6789 6407 2557 1500 2510 7049 8718 6026 9332 261 1672 6125 ...

output:

38355253699031

result:

ok single line: '38355253699031'

Test #85:

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

input:

200000 1
880 7961 4911 8213 7723 3314 2374 2886 7875 9665 3809 7694 8178 8291 4938 5634 873 5400 6231 7835 5221 9920 8699 324 6923 387 7987 2425 5323 3109 1758 8586 5966 6364 6158 9177 666 5441 6397 5286 278 6522 1346 1533 4585 4074 8026 9401 3944 7743 1399 8566 1690 5702 8316 1656 5440 7339 1528 46...

output:

37793061979981

result:

ok single line: '37793061979981'

Test #86:

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

input:

200000 1
8557 8793 19516 16927 1575 7255 3329 15009 13493 18339 15877 14906 6932 1510 17419 15690 5638 15668 6616 6602 10821 12583 11916 17882 12443 9622 12603 3863 17657 7124 11797 19432 1326 17750 19408 894 64 8868 16988 13080 9817 13355 10339 14560 3040 5261 9350 10511 2521 1901 15491 19377 12196...

output:

78032230529060

result:

ok single line: '78032230529060'

Test #87:

score: 0
Accepted
time: 11ms
memory: 5700kb

input:

200000 1
17666 17496 17643 18360 5666 8547 9560 6248 9840 19269 7298 3499 4894 4219 4932 15927 1404 19230 19221 6010 5214 17497 15721 16728 14558 6644 2598 7200 14590 9300 17712 14818 18767 3691 12406 11462 81 1382 17884 4275 7465 12733 10449 16562 8683 18951 6004 18658 14863 1743 3380 19104 1924 94...

output:

78182996070841

result:

ok single line: '78182996070841'

Test #88:

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

input:

200000 1
12198 6057 4719 9743 16394 8372 17842 17969 10223 12216 6635 4034 1388 12771 8295 540 12230 4224 10195 11081 13481 10919 3006 10778 12597 19260 16027 18177 3292 11300 4787 8510 6785 14913 11429 8135 19610 5532 7253 5242 19246 16820 4067 6549 4437 770 11630 2367 8315 13344 14056 4683 17456 1...

output:

78210233080667

result:

ok single line: '78210233080667'

Test #89:

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

input:

200000 1
376 13577 1407 10905 11722 9942 14605 504 14933 2680 15470 4477 5437 15575 6165 12530 969 14651 1833 6330 8110 1097 17845 13400 14155 343 12272 8451 10432 16435 12808 9684 9616 17462 1696 14223 14398 17496 10720 5023 1763 11420 19971 18343 5732 7553 16209 557 17883 6650 1107 271 2853 5538 1...

output:

77796701768363

result:

ok single line: '77796701768363'

Test #90:

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

input:

200000 1
3845 2105 2362 17200 6297 6535 14297 13115 6753 8140 4390 13168 6383 13630 9781 81 694 15287 14203 580 8249 10966 18344 3479 11022 2810 18227 13703 15219 6625 10918 14153 17729 4810 14426 10926 9408 4856 5933 19568 592 9217 14921 844 14021 19228 5175 9862 15513 17433 10492 12260 16292 863 1...

output:

78213830350548

result:

ok single line: '78213830350548'

Test #91:

score: 0
Accepted
time: 11ms
memory: 7856kb

input:

300000 1
67669 99682 6707 96357 10506 51093 77265 87081 14379 94051 91485 13221 91819 34603 17721 633 52362 58783 31906 25544 47465 80777 87459 90746 26331 91337 28360 7246 43806 98704 97112 64646 43928 71393 12611 42260 41922 62195 86681 63195 27395 12155 64503 30196 3128 4857 42352 52164 83566 886...

output:

996530458053949

result:

ok single line: '996530458053949'

Test #92:

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

input:

300000 1
39700 95961 70840 34416 37470 655 31974 10528 48978 42707 2220 74305 97286 54892 39555 27366 52967 66092 70226 58223 49821 58999 78811 52737 89834 64869 37839 8317 32209 87508 51934 88807 23168 34058 20787 94777 31474 29350 12831 16701 31319 49726 2726 99905 4418 66625 13480 79165 17698 725...

output:

997603308859369

result:

ok single line: '997603308859369'

Test #93:

score: 0
Accepted
time: 11ms
memory: 7848kb

input:

300000 1
37979 49400 16219 51222 62128 61320 9332 48947 78518 93933 65183 10746 40250 74804 54758 15176 91884 91091 12117 49773 14523 75744 49489 45128 36157 33305 85325 9559 59956 20598 31058 45202 69522 89892 54039 97149 43035 25493 99983 7319 75790 19837 3388 18592 7192 81983 91435 93263 13087 44...

output:

997532418999080

result:

ok single line: '997532418999080'

Test #94:

score: 0
Accepted
time: 11ms
memory: 6132kb

input:

300000 1
55169 12174 76473 96130 79643 18707 76312 25254 39322 28127 82705 53124 6047 17858 51254 79998 3590 70740 93062 6927 4167 99538 2527 67652 64236 46796 98213 31394 85267 93032 50314 3338 95750 79851 87496 80401 63865 86621 24843 68817 18170 61664 10570 61785 46538 59091 79119 13580 27396 131...

output:

995720148972235

result:

ok single line: '995720148972235'

Test #95:

score: 0
Accepted
time: 11ms
memory: 6200kb

input:

300000 1
35408 77523 92054 64899 49706 22647 99427 81788 23773 67555 81763 66751 60374 96972 75598 57282 94723 7543 63971 12870 28356 55337 70276 39388 9429 43612 45086 67394 18586 62141 69690 84991 20092 87080 96267 30327 10263 47828 18740 44810 58434 25717 14629 46628 87496 70837 24291 9084 53496 ...

output:

997624664586811

result:

ok single line: '997624664586811'

Test #96:

score: 0
Accepted
time: 13ms
memory: 6468kb

input:

300000 1
112168 70206 158215 121552 22271 14853 103825 9296 145014 133056 23465 87903 165735 123239 58864 134400 187562 83314 102595 177430 34812 158487 20152 692 198340 53225 100658 117315 13858 123543 167117 156495 111668 25418 135819 160723 189018 175616 197160 197517 53094 86356 183691 199696 12...

output:

2449840917984294

result:

ok single line: '2449840917984294'

Test #97:

score: 0
Accepted
time: 17ms
memory: 7888kb

input:

300000 1
95659 97158 129738 108599 125269 103768 70109 35669 16497 53292 87021 196995 44472 121293 103907 46331 175370 183274 2405 170346 150542 4809 95677 15454 176942 58539 95363 59195 94161 61116 95525 115798 86903 136745 193220 150162 60835 102996 154046 101444 81108 32316 21282 102539 46829 136...

output:

2449097259350305

result:

ok single line: '2449097259350305'

Test #98:

score: 0
Accepted
time: 17ms
memory: 8136kb

input:

300000 1
12056 153400 61451 79871 68569 139696 12814 12321 21689 63828 21547 52733 133236 152681 133495 10902 152094 195588 97136 190004 110829 4596 199420 22151 155726 104793 137366 83197 3355 79376 164388 43761 39425 45376 110008 144462 57954 196236 186611 194408 6468 103092 184152 34442 178373 13...

output:

2450277514320045

result:

ok single line: '2450277514320045'

Test #99:

score: 0
Accepted
time: 17ms
memory: 7672kb

input:

300000 1
96441 122762 61632 88605 56847 31998 107796 159344 92615 107961 46042 120005 61752 150686 154063 28862 84130 180218 78887 164259 115851 162535 103373 118745 135178 76369 17686 105625 104723 197513 189654 147689 123896 66179 188449 175442 81944 30647 133377 112955 11484 149443 107734 10381 1...

output:

2449223690367456

result:

ok single line: '2449223690367456'

Test #100:

score: 0
Accepted
time: 17ms
memory: 8156kb

input:

300000 1
190740 191657 11079 140035 165050 29338 75161 79021 184844 13522 48022 150978 117078 27259 8608 87012 78780 164065 194049 43580 199642 137680 94968 37382 142467 89873 30514 38495 33612 97998 57067 10756 22805 26145 122638 52931 37993 42433 179430 58937 419 156198 28823 139892 188900 146071 ...

output:

2450019018412279

result:

ok single line: '2450019018412279'

Test #101:

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

input:

300000 1
101970 85168 161130 73918 146591 70425 27162 162429 134056 143458 14884 123346 47764 8110 112781 60619 1255 153408 41497 132861 28426 199413 163538 160267 1062 95204 153218 188352 196775 138078 133731 88415 45548 93074 114062 92044 154442 60382 144802 143462 43437 49500 23884 60852 92889 74...

output:

2449529477016127

result:

ok single line: '2449529477016127'

Test #102:

score: 0
Accepted
time: 17ms
memory: 7704kb

input:

300000 1
95957 190996 131860 45347 42864 123625 35622 187735 99377 170929 5205 139252 94033 91399 158623 18655 142189 91720 83937 8470 188677 99317 125378 127082 132141 91788 179927 133616 48343 22800 165495 110330 12586 70671 173568 95766 25586 146479 47512 70493 161286 146586 105598 73393 185907 1...

output:

2449260463935716

result:

ok single line: '2449260463935716'

Test #103:

score: 0
Accepted
time: 17ms
memory: 7932kb

input:

300000 1
9313 105690 95527 22932 97236 157397 183580 15723 99048 84254 154566 189414 188567 95488 141841 108338 173195 172253 74991 88621 19249 170507 171106 89170 190996 191958 26474 52791 165875 148611 166721 93578 106611 93948 160969 7873 25185 79386 3003 145107 131915 124556 119341 29157 4614 10...

output:

2449817318423857

result:

ok single line: '2449817318423857'

Test #104:

score: 0
Accepted
time: 17ms
memory: 7932kb

input:

300000 1
152811 145586 85403 59127 38502 18792 151561 136883 46759 153047 74045 167481 149069 105557 189231 166291 35771 67537 175708 195492 113975 163302 4182 17772 42709 52167 56547 14795 15778 87462 79343 124311 7523 42256 108135 77227 85807 128272 76579 141191 35307 149395 185702 115824 66914 32...

output:

2450136152078663

result:

ok single line: '2450136152078663'

Test #105:

score: 0
Accepted
time: 17ms
memory: 7776kb

input:

300000 1
241 149433 16220 86405 9159 50069 154157 149378 159018 195102 166092 97536 122870 76567 108620 185053 184733 181357 42899 39058 122590 140618 23954 160947 73506 46684 173626 71133 197790 22801 16519 110997 181879 173181 77329 45991 417 111001 150096 78432 4321 168496 106034 107949 198445 18...

output:

2449726649389130

result:

ok single line: '2449726649389130'

Test #106:

score: 0
Accepted
time: 14ms
memory: 7144kb

input:

300000 1
2652 244957 207494 54509 196832 204664 13067 49224 46614 56083 91134 164164 151879 65611 134387 243209 52523 189751 220308 233334 47125 187410 83992 142221 177723 238672 114899 51986 68356 20446 26271 118098 67044 244325 149433 129320 190666 204538 76710 218427 179541 240158 144583 9612 229...

output:

3407285868597724

result:

ok single line: '3407285868597724'

Test #107:

score: 0
Accepted
time: 16ms
memory: 7640kb

input:

300000 1
140197 102963 36137 78209 94859 97711 9185 37413 210159 228364 187421 76751 74937 239756 15006 207832 109777 106983 38867 136139 98814 229772 38887 231598 170662 73533 90810 246598 66634 116608 212626 95017 131126 236897 236791 32471 57154 157493 127870 112739 115452 57802 81744 50417 24087...

output:

3407237236789894

result:

ok single line: '3407237236789894'

Test #108:

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

input:

300000 1
186654 186829 144016 249654 205262 200806 180879 44103 106020 56751 225063 163974 193366 40005 185416 219270 84442 59285 58055 94238 53924 48770 137201 200071 47588 131801 55492 85178 64761 163245 210327 143295 66010 174610 82195 115449 77399 105994 226439 187527 242088 106209 154662 24263 ...

output:

3407214824448780

result:

ok single line: '3407214824448780'

Test #109:

score: 0
Accepted
time: 13ms
memory: 6736kb

input:

300000 1
191436 225645 202742 9746 84620 123762 115319 6646 14634 199422 197415 33843 153519 240836 212672 230104 148344 23770 29156 103927 154955 187787 198910 62912 8798 137507 22452 119304 221148 7588 2672 61040 32086 48474 53875 120746 33610 166218 32806 116877 117451 44616 36353 191503 235402 1...

output:

3407248798394365

result:

ok single line: '3407248798394365'

Test #110:

score: 0
Accepted
time: 13ms
memory: 7640kb

input:

300000 1
156227 116325 219633 118281 117269 94369 82802 40479 19000 115802 75030 182307 91408 124517 72649 74825 179862 67929 86340 143584 218745 89988 56330 17518 233046 160418 232233 233144 116131 228856 197031 99812 202457 96741 35696 247833 165100 161488 34648 171841 20235 168132 204122 216857 1...

output:

3407168344619463

result:

ok single line: '3407168344619463'

Test #111:

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

input:

300000 1
82429 208277 63302 22611 189869 206775 88622 197932 200211 141201 211710 3269 205826 183473 204727 24567 176538 213981 149813 53935 209349 144668 164276 218607 153688 170296 195069 134840 76354 63562 27543 109149 36570 94172 131517 19262 22423 116355 65576 227010 43234 173275 40551 102441 1...

output:

3407256835349536

result:

ok single line: '3407256835349536'

Test #112:

score: 0
Accepted
time: 17ms
memory: 7724kb

input:

300000 1
190508 147888 167606 192585 222667 225795 220886 133406 73793 171957 157289 118001 126141 92228 188846 213209 117018 214854 240438 204471 228787 225590 212026 60311 87635 187619 212818 129544 206928 185971 66316 224611 223002 73586 57704 119825 71090 30690 14550 50189 36090 173506 165789 77...

output:

3407484770130363

result:

ok single line: '3407484770130363'

Test #113:

score: 0
Accepted
time: 16ms
memory: 7780kb

input:

300000 1
200925 28291 80530 87476 197426 213011 119883 35579 93099 163684 45384 52389 97634 131769 90062 13455 166999 139874 162889 208402 17210 137260 138633 208384 16211 128294 118876 135326 140419 47403 113082 47633 34543 167311 80247 215640 175779 194076 29922 64874 67844 149004 49035 7374 12781...

output:

3407423832239033

result:

ok single line: '3407423832239033'

Test #114:

score: 0
Accepted
time: 12ms
memory: 8116kb

input:

300000 1
61250 211629 5302 65684 237124 133178 86886 116933 164875 153235 155404 206331 56391 9061 221212 239566 87050 78088 160902 159650 157920 216801 191639 51217 99011 236649 69376 163138 47316 208687 52759 150349 246826 39745 181582 69978 33277 106638 25971 184946 35271 212160 178008 227498 242...

output:

3407325960908453

result:

ok single line: '3407325960908453'

Test #115:

score: 0
Accepted
time: 12ms
memory: 7864kb

input:

300000 1
39962 175880 47620 97314 29209 36139 213764 123447 81196 155577 22208 218075 204887 14537 231636 78544 12661 7289 80291 9583 96005 34791 142482 191907 22329 165375 162706 232822 246712 122331 211112 40848 180857 1575 193518 132183 122999 60165 27956 13759 41080 106694 40656 239185 82180 491...

output:

3407219787454861

result:

ok single line: '3407219787454861'

Subtask #6:

score: 36
Accepted

Test #116:

score: 36
Accepted
time: 239ms
memory: 5688kb

input:

10000 50000
33 26 45 43 23 46 16 27 34 33 1 2 13 12 41 33 9 23 42 44 38 16 50 37 50 38 25 15 23 1 43 19 23 1 23 43 49 13 38 38 48 26 19 33 5 23 38 7 23 4 33 33 7 24 38 48 49 19 14 1 4 33 28 12 14 24 38 23 23 33 7 4 50 24 19 34 5 50 23 4 33 43 3 12 1 33 38 23 3 43 38 23 24 47 26 27 38 5 43 4 3 23 25 ...

output:

203570748
294520750
25546954
156699520
155943016
226210660
3011356
13521
179659413
78057812
333237
14798269
920596
14279581
132758563
165103652
108478284
73572727
386276972
205780539
376782056
58193479
100497177
116907859
52733954
48533376
243618223
36411387
175925851
49995402
28755089
171455
778889...

result:

ok 50000 lines

Test #117:

score: 0
Accepted
time: 278ms
memory: 7740kb

input:

10000 50000
90 82 17 3 52 65 9 52 48 64 14 76 38 56 66 42 51 9 100 8 30 56 48 76 83 23 23 8 87 4 88 8 94 6 30 42 78 42 12 17 70 36 19 64 87 76 62 16 14 87 36 58 38 57 36 36 48 51 50 82 17 73 52 82 17 54 56 64 84 83 82 30 47 49 94 40 43 56 9 17 54 3 76 64 64 54 26 57 18 82 26 32 47 8 49 56 99 36 57 1...

output:

241939074
3967365
513712393
22124449
209957126
656780600
864336
225506392
347433799
773542362
93871
247167455
21633478
230742047
71441565
6279052
365516565
261547845
98844453
2651481
9523748
2033161
149646139
176863076
220437212
87119997
2872335
25420469
379151118
50569428
6558088
435856457
2486031
...

result:

ok 50000 lines

Test #118:

score: 0
Accepted
time: 334ms
memory: 7668kb

input:

50000 50000
2 47 96 43 61 83 74 2 56 31 84 79 60 46 28 71 10 38 76 78 71 98 90 71 78 94 50 53 34 90 29 24 76 26 14 80 92 36 45 62 71 50 52 10 39 37 35 87 71 13 37 52 28 4 31 10 34 71 14 1 35 86 11 46 78 54 35 43 45 16 39 60 36 46 96 11 63 11 79 91 34 63 100 47 45 9 47 52 33 69 94 100 16 13 45 39 90 ...

output:

2564630994
35564133
87639
10463186906
7253186
773588289
3591622534
559691008
1822478555
4209491575
99373730
6644663032
12096433882
5508663677
478563084
21050475
7578876881
2516942334
727872462
3190809108
12549029614
7270912653
1525946430
1304773536
5730709187
6402409098
4567578261
1083015746
86618
6...

result:

ok 50000 lines

Test #119:

score: 0
Accepted
time: 305ms
memory: 7948kb

input:

50000 50000
254 27 276 417 166 400 84 476 120 458 40 118 244 105 218 20 3 170 321 21 138 487 289 478 256 63 230 470 259 468 417 105 484 270 367 181 147 475 392 122 237 246 233 23 109 158 153 102 257 420 256 463 138 246 295 140 56 372 310 363 102 369 185 72 76 351 56 168 104 183 450 318 400 493 159 4...

output:

14434686758
59875302959
4327956816
3400248206
30788676439
29824843600
3292801203
13262504840
18663188135
9933722618
11161544
886601851
801059298
105584021295
8882149065
82401958988
3457302310
6021711460
41959564475
64499749430
11631179171
7312660985
750956760
917967743
945922213
70072787540
51241423...

result:

ok 50000 lines

Test #120:

score: 0
Accepted
time: 198ms
memory: 7736kb

input:

50000 50000
699 83 492 897 662 341 807 350 747 862 458 560 504 928 704 499 963 264 367 737 435 992 164 947 46 529 800 10 445 904 397 375 342 188 532 1000 560 523 628 625 904 420 35 916 519 68 879 799 523 193 616 499 342 450 494 341 519 481 776 633 855 935 634 113 389 8 504 159 704 766 488 881 810 38...

output:

4108723613
19264706584
115827048889
150352695
38350380
118443512826
16903914750
4132989804
75572708327
26497063049
77796846099
1370678337
54754776100
63128280427
1991776126
1159538495
27805421458
613838381
73002858496
11815464194
68663306075
63403248440
21390221918
40792114579
8640013875
15516665035...

result:

ok 50000 lines

Test #121:

score: 0
Accepted
time: 328ms
memory: 7924kb

input:

100000 50000
299 480 708 691 76 173 452 708 761 702 828 500 666 457 43 925 191 869 621 109 203 517 473 173 456 159 470 353 689 244 498 708 297 676 288 765 106 442 154 473 869 10 446 716 644 665 278 738 585 796 379 456 730 229 586 712 158 882 664 181 246 728 423 121 789 555 750 665 555 941 771 854 22...

output:

485908036625
288128387228
306573013531
90002466964
122199157561
84029297239
6377614342
148886840610
179190216174
122634854101
161092445697
3785501993
55601778728
40349214942
502101622611
65222273780
426078776926
118419639257
112794775782
303445556558
15190547191
133584090795
383595500620
49071072207...

result:

ok 50000 lines

Test #122:

score: 0
Accepted
time: 216ms
memory: 7744kb

input:

100000 50000
519 1482 1174 1981 1891 1521 11 750 1750 379 244 800 9 140 1752 1537 75 66 835 140 290 1492 2 820 1356 824 799 1528 886 1079 684 862 770 1100 958 547 480 1342 1584 1391 820 186 979 901 126 1 1863 1537 1630 1490 690 711 1648 1230 495 436 124 300 1257 636 35 1439 598 18 657 1710 762 1419 ...

output:

136866075410
984794277546
1182920771867
791573127654
14300936554
1152071534734
641625081113
15972187
487344604921
663669759261
13821035415
84472470788
437062469845
557228217475
70617656993
248791699926
511772322969
115065981803
418435355375
119466026358
245088676793
168558650765
18540981180
60544048...

result:

ok 50000 lines

Test #123:

score: 0
Accepted
time: 605ms
memory: 5640kb

input:

200000 50000
181 395 441 985 760 829 597 161 615 964 314 984 122 164 825 56 238 164 609 871 660 261 911 539 292 342 286 838 83 834 737 301 763 602 141 868 587 527 217 373 498 780 111 107 818 903 785 993 360 459 112 8 993 225 984 164 564 457 739 93 154 903 93 225 19 442 717 381 817 826 215 429 872 65...

output:

103730445845
1181687906730
2129051278726
576911145996
200315934751
613864966510
10938959198
97205203200
23822396512
16781387263
1248819733892
304421305982
825984163900
20801076740
1198567092017
338390512644
1044175386763
156044441863
576646205784
341449997026
1617434289511
1297699976602
49878331114
...

result:

ok 50000 lines

Test #124:

score: 0
Accepted
time: 225ms
memory: 7900kb

input:

200000 50000
2965 1974 801 2271 285 1266 28 3175 1144 3915 4669 4237 3414 675 1504 3947 1957 4644 2455 3108 3618 4427 4906 1636 4860 2270 246 4636 1358 3504 304 2120 961 1739 4854 1372 2676 4621 2453 4598 2976 4436 4489 715 2759 2436 305 4653 3476 4036 1737 889 253 355 1786 3543 781 2378 2034 186 35...

output:

2651445775793
798464607649
3488223472342
1130665362882
4714881361821
5627562466203
2533223386066
2606983778923
1176964379745
2020831559383
1845410693306
210833078376
715218262453
4440049442472
208054368
4650820964895
334816647775
310515008363
947800
7836961359158
42401824777
2282926540075
1443938763...

result:

ok 50000 lines

Test #125:

score: 0
Accepted
time: 175ms
memory: 7692kb

input:

200000 50000
1077 6417 6633 7494 6792 1864 6029 4574 497 8295 9400 9955 8212 7240 557 9649 5366 3356 3163 2590 5315 385 8266 8090 3852 285 6185 5203 4312 8792 3706 9252 8976 8273 2535 6875 7359 3821 1114 8212 3025 7801 1647 2797 4736 5883 913 8198 9928 3688 2792 8895 302 1403 9941 4508 9875 1242 870...

output:

4536874358045
27795541481058
22809641690926
1503873203853
10045119512144
18502225452710
32004087869336
15866678992672
8598280441653
6271489252457
15982569109489
1533893608713
12760205662091
1995242503814
920987254891
329703973412
1345498910289
15231570434518
15764683300543
689392845886
3113825745874...

result:

ok 50000 lines

Test #126:

score: 0
Accepted
time: 933ms
memory: 7752kb

input:

300000 50000
114 186 153 224 275 67 225 73 148 161 123 92 84 55 212 272 224 191 1 262 247 187 276 296 280 294 113 194 297 213 271 277 275 115 268 188 88 211 15 188 248 6 168 80 41 43 291 140 237 290 235 80 235 219 222 293 62 28 277 120 290 148 294 288 80 248 164 92 56 258 114 220 15 10 231 31 101 23...

output:

1362525052496
344014101280
2003988033487
312279223914
745388888501
424036404017
1026060589720
447442132684
43925461357
1647148654278
579316352142
14204086860
41516666083
611195118092
14247030882
931032096917
11884825285
140392346508
1594194477625
1317749055054
1092723827967
4615076721
1639979020043
...

result:

ok 50000 lines

Test #127:

score: 0
Accepted
time: 944ms
memory: 7800kb

input:

300000 50000
239 191 224 60 4 38 26 42 195 271 149 203 100 281 264 94 37 236 59 26 60 176 204 191 57 133 219 267 238 275 300 241 245 207 106 199 110 239 26 271 86 34 180 28 146 236 179 99 83 8 147 267 120 221 267 233 232 116 54 217 290 229 171 111 87 220 81 265 114 1 236 84 131 9 66 4 151 274 285 15...

output:

160757905551
18680908238
790912383225
355319372350
9085231672
742383472658
505779751366
2728600153
126031840
96034943529
242559364277
30416560035
190098005045
903604463130
851843804550
177655270752
699954190897
56165176659
67913411
73950589325
249017432707
455707941381
735749910384
50194519068
88459...

result:

ok 50000 lines

Test #128:

score: 0
Accepted
time: 945ms
memory: 5896kb

input:

300000 50000
191 267 230 239 249 173 54 116 258 4 2 173 228 258 199 2 47 296 199 164 218 220 164 51 258 175 94 210 266 243 20 55 227 154 94 22 48 208 23 247 44 173 218 140 44 137 141 255 88 207 92 29 233 240 164 217 296 161 104 286 22 188 78 147 48 89 99 106 221 48 217 68 258 274 101 73 139 135 105 ...

output:

9382121694
381642395909
20138431861
35465943
17457072000
80408564946
1262072942981
309054499061
65763184731
524651351925
467291560682
7638737262
442551380725
917984112743
392987708
102324432046
681334523981
115422244185
343194706693
349302359243
752212950
462054425035
650008584364
520540830869
94514...

result:

ok 50000 lines

Test #129:

score: 0
Accepted
time: 936ms
memory: 7792kb

input:

300000 50000
251 285 135 249 184 125 52 238 285 212 175 242 181 247 210 251 182 125 163 155 107 248 237 196 251 236 218 12 87 199 125 285 220 221 72 172 216 86 71 151 261 285 6 199 127 33 72 287 32 153 85 135 189 296 294 181 51 166 85 213 196 237 87 17 42 217 130 220 235 271 115 53 75 178 233 199 18...

output:

36851474584
596812584277
3889857113
994119184918
424618157219
155577530987
1424774927585
290658956569
145405212239
965189227315
161792060
561249475214
25061413103
1438479199027
1390960147051
1618731442638
2020505273350
479020644578
3938704512
1010880267513
583841361939
7695570853
72341160206
4762251...

result:

ok 50000 lines

Test #130:

score: 0
Accepted
time: 964ms
memory: 7808kb

input:

300000 50000
195 300 267 81 170 15 130 81 246 29 181 279 93 28 173 12 265 162 63 176 253 5 182 118 279 125 10 175 68 32 29 276 183 81 87 279 182 121 94 289 8 84 234 238 77 260 188 2 269 220 62 166 142 229 27 194 194 15 31 7 152 264 157 184 117 135 138 210 15 55 95 14 145 236 272 94 246 137 81 285 32...

output:

92518262672
653557332070
37026010759
552288044912
269966861443
601732539778
347126449197
127605090513
7241277840
851486444007
70975726882
1679483807845
141733271394
1198829953271
827949557801
1214290085497
538281214027
57291902157
497682730348
74733684305
16976033100
310640185105
262322857386
240473...

result:

ok 50000 lines

Test #131:

score: 0
Accepted
time: 1084ms
memory: 6408kb

input:

300000 50000
225 87 444 312 72 281 44 180 346 431 135 179 59 8 442 357 169 309 46 109 429 322 438 460 240 375 251 248 399 1 244 229 478 169 410 193 236 207 61 354 31 67 125 31 128 135 330 169 214 264 458 87 348 225 316 42 410 352 270 20 417 95 192 126 332 241 225 357 200 332 263 312 460 480 375 424 ...

output:

5563418176
106964501510
365427861630
28491592154
11811576062
5959900
18006512376
2101019765
346318882908
202855993876
1274200638122
42394837616
663455820544
145775988387
2425717474643
22722708734
105072703037
515745594777
1541797708964
291811243281
2923637171432
599086099124
228696086
697120516992
1...

result:

ok 50000 lines

Test #132:

score: 0
Accepted
time: 1083ms
memory: 7808kb

input:

300000 50000
57 75 98 422 277 157 104 70 100 369 150 58 276 491 473 464 45 417 198 262 376 309 26 324 282 365 83 323 329 421 31 335 224 369 491 350 60 200 141 91 369 383 26 295 194 276 152 118 168 280 445 484 476 102 309 45 243 255 26 57 100 19 459 461 100 422 401 239 69 100 26 124 47 262 55 455 194...

output:

937918512499
759819815218
265380794079
210424103670
1166627172713
2651481349110
31837894375
2066332831259
1426332542
1001636891200
9870089195
219325343218
6131256326
4044880432977
1031437404462
843182025
384923295193
3091128499040
158482362360
41656105565
20442105868
3087890821571
114764161684
36225...

result:

ok 50000 lines

Test #133:

score: 0
Accepted
time: 1080ms
memory: 7712kb

input:

300000 50000
207 395 470 297 212 82 394 212 25 312 351 349 104 359 12 24 228 184 60 337 164 479 120 168 29 35 207 396 198 470 334 88 192 176 67 164 211 402 349 169 332 35 339 10 301 38 57 337 133 67 23 152 332 128 468 89 381 335 176 332 6 174 370 205 87 40 293 304 187 315 260 167 120 311 33 154 41 3...

output:

102389871467
2928377693548
88489806929
131260168729
355576731842
857631039592
2566694788097
1446894896786
165293020726
95376364835
1161569608591
1855498866
2852448987264
89300955028
291544816897
96168723
297671248452
1367066235
102602058940
847480941051
2348256658737
2901947059681
392926576227
13692...

result:

ok 50000 lines

Test #134:

score: 0
Accepted
time: 1086ms
memory: 7728kb

input:

300000 50000
303 146 410 79 108 200 96 467 21 83 230 423 7 133 117 425 200 206 89 133 387 213 330 184 232 69 496 218 29 187 488 362 224 48 414 111 353 468 428 104 337 32 242 94 124 478 467 106 153 99 232 16 364 119 317 124 427 307 213 423 376 192 41 415 163 410 24 207 161 106 38 153 245 200 479 374 ...

output:

1132859602993
3406371016
583847757060
2614578016310
29090183296
828050266213
2224105204724
251525888655
1994344174
1148002468
437084233302
3146828199718
2436170782613
252364935487
9525808512
1314594934687
4245712662
1019941869778
135427759
149281594387
15622407075
533712633314
876899222
73034079379
...

result:

ok 50000 lines

Test #135:

score: 0
Accepted
time: 1086ms
memory: 7748kb

input:

300000 50000
173 133 24 93 420 495 307 57 325 458 397 274 155 374 140 298 343 68 477 402 4 194 140 60 213 324 407 217 341 399 234 132 106 77 468 400 281 135 496 169 119 459 217 400 104 161 143 75 77 162 83 392 226 234 24 44 227 254 139 285 42 70 305 187 106 104 310 395 185 474 500 275 221 67 135 286...

output:

1464061350842
761730607496
59144455679
664298433254
20949318187
82130253555
1043147917850
46606602
17066851025
6897698948
264819171118
2056109334011
1846865280460
342708818837
436172140406
63459031918
3351850142
41280245534
70756654722
269338535914
561659292196
4648679746
590072951253
2605828711720
...

result:

ok 50000 lines

Test #136:

score: 0
Accepted
time: 1078ms
memory: 7980kb

input:

300000 50000
11 193 256 236 103 40 427 20 151 300 440 198 75 365 434 233 204 210 234 336 197 433 71 213 291 149 191 225 12 207 486 118 133 40 196 96 131 353 439 171 386 47 20 171 4 382 319 402 207 134 163 392 477 254 442 99 116 36 73 289 184 102 310 214 239 264 464 159 51 174 466 384 489 99 85 455 1...

output:

1486013732847
45014095
1441770498394
827990437914
1949625868793
34385473438
9322744462
75118937660
75039775745
744562
690071438527
1145642188450
1834089099960
10605388427
34253258381
60812002290
302033775611
416233802123
2531505163821
977815134372
93329684700
11068788550
1993792320769
233331313162
1...

result:

ok 50000 lines

Test #137:

score: 0
Accepted
time: 1077ms
memory: 8016kb

input:

300000 50000
381 432 262 268 424 367 389 238 416 227 381 213 210 403 209 327 93 342 429 366 129 240 20 350 139 429 52 325 279 416 223 237 96 118 123 306 379 196 149 442 376 22 156 434 2 226 93 310 84 156 292 234 489 226 197 444 169 203 192 15 364 298 487 429 317 276 268 416 51 432 348 29 402 209 251...

output:

231051591734
61298439543
1022657302
828307969606
50507035107
55141254195
2359734734539
884423239237
485495010396
232140154370
124034556250
52901033915
8602871523
1490427033561
110973087826
4013299766
889645406540
156794320988
34344974861
1678587694359
14412128743
496349019708
21290511427
29622064998...

result:

ok 50000 lines

Test #138:

score: 0
Accepted
time: 1076ms
memory: 7824kb

input:

300000 50000
342 425 55 250 257 442 2 172 55 123 110 293 458 42 378 300 436 46 278 121 368 484 223 176 35 120 38 95 290 38 118 384 261 287 316 105 220 283 336 412 374 437 42 122 427 425 52 61 297 172 20 41 123 309 220 46 353 123 427 1 206 122 429 252 346 363 215 366 198 57 388 427 122 47 4 132 16 38...

output:

107970771966
239304902026
289945225925
77283281678
105974246970
2206915567257
39847375228
1644827681446
286887091025
493271823544
239315208922
3091066668360
448694320524
608956743200
711452539
935301638281
1137828162949
50814348988
258237366561
17051768209
40481815126
2355982049040
64721673557
31078...

result:

ok 50000 lines

Test #139:

score: 0
Accepted
time: 1085ms
memory: 7748kb

input:

300000 50000
107 252 441 242 142 22 464 274 431 499 32 322 401 473 73 437 278 94 151 323 118 411 243 389 322 145 402 428 115 40 105 427 375 439 193 138 380 411 49 94 216 424 274 40 75 322 310 140 478 300 464 427 150 197 474 464 472 456 499 5 26 182 228 69 322 354 372 476 300 339 285 322 264 1 478 6 ...

output:

9914246869
7702306569
24832608618
1098842534691
507382945234
3156198908947
118481133751
296143708370
302970071706
790069714521
164337788711
9597566791
17311397013
3162085725717
152580308972
19921716907
40817966938
5105895838
998445121692
7524593413
185983568528
174608430849
847578864690
31661877595
...

result:

ok 50000 lines

Test #140:

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

input:

300000 50000
483 109 273 143 420 336 97 147 76 497 97 209 340 250 350 157 97 375 188 288 460 146 154 86 290 374 299 353 211 131 475 45 191 39 460 415 294 241 176 404 431 345 187 222 120 283 311 76 202 117 83 141 13 364 135 469 209 262 181 193 268 288 463 27 187 28 414 23 461 260 288 435 448 430 319 ...

output:

1157972406915
2327002203
161706100961
264314953131
1042323774913
104818049675
358589241389
2022368204528
3391632110814
50049780936
168049352094
1986745413130
409182632476
1760690591182
213118634889
36395279272
90840587563
2718360307143
195012673070
149193616062
180545207475
1519668285251
1548366915
...

result:

ok 50000 lines

Test #141:

score: 0
Accepted
time: 890ms
memory: 7792kb

input:

300000 50000
999 176 159 916 957 953 933 539 676 539 954 945 484 495 153 722 531 744 203 782 585 813 303 481 130 768 891 885 999 269 422 94 240 793 195 341 42 125 150 25 683 578 57 405 787 841 985 638 195 577 854 879 687 39 450 191 521 172 497 425 550 101 824 922 951 929 308 612 135 393 21 428 757 1...

output:

1093411097671
524518441811
1407115106870
2565893520157
55835957564
284751191345
3192490472
136276425625
2080660946178
309309124302
46500508416
14097145554
3402688007
856150326503
2981326819586
1860865396302
478236560995
6273282829
6734197748556
1171443002837
13735678633
4522973054341
1497963189164
2...

result:

ok 50000 lines

Test #142:

score: 0
Accepted
time: 923ms
memory: 7760kb

input:

300000 50000
179 225 107 751 753 8 552 35 766 749 736 637 546 702 548 519 462 979 992 41 332 367 902 934 336 66 627 296 24 81 808 496 13 855 89 929 466 451 660 382 448 695 803 952 845 300 851 349 91 987 200 395 466 579 934 615 791 418 683 129 706 700 788 995 56 360 583 611 202 969 3 865 344 687 704 ...

output:

23440462207
1137515096550
1190934926418
2403288177171
637181446462
11446934278
221191153297
28967599146
4254360216390
243561806480
3289230089705
557580466295
319353011419
3367097683305
64819767783
38925623626
355847736302
2011663265373
12226032753
2470563866675
280155302905
672365457868
402862290371...

result:

ok 50000 lines

Test #143:

score: 0
Accepted
time: 906ms
memory: 7712kb

input:

300000 50000
657 93 63 513 311 311 611 339 682 337 156 63 891 133 367 848 605 789 889 435 264 973 404 672 366 849 527 640 501 194 437 439 332 901 389 678 375 819 282 673 286 435 819 96 938 726 955 435 955 496 45 980 994 327 141 768 839 7 276 593 703 562 289 448 6 653 313 75 981 722 913 178 566 672 7...

output:

7711860429770
843070765487
3236529620409
217810411842
32788814770
348440758399
3270433595446
92432927441
1755452438481
902273480679
748510626461
7813651959
166509137891
2494876113232
3364278222267
3248580110901
2005109789240
3076233532
185120423586
4258008947028
3166572599044
2507728159346
979841177...

result:

ok 50000 lines

Test #144:

score: 0
Accepted
time: 901ms
memory: 7708kb

input:

300000 50000
552 210 157 540 646 961 745 505 676 255 466 147 623 836 701 650 550 503 297 745 981 147 423 997 622 30 12 776 558 884 899 605 394 217 127 32 421 109 300 192 163 686 887 729 300 781 755 244 590 243 84 594 315 500 853 475 962 738 41 399 413 38 863 960 823 544 630 742 690 135 943 470 188 3...

output:

395821485179
2114492269586
281537751755
24053204
1131344112583
2177146898412
3607437805232
940716779192
1772119339835
1498045305444
5398949706925
1223791058887
1633502358659
3462696524502
190097252378
2268768129939
2581459069178
1036100791872
1491911386420
5951773870522
89039108961
318841298174
5433...

result:

ok 50000 lines

Test #145:

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

input:

300000 50000
411 499 230 980 6 810 48 194 202 7 952 337 672 871 281 350 112 176 263 475 704 330 458 265 613 49 303 733 595 578 265 887 53 303 439 347 518 551 879 256 45 285 302 520 886 330 933 854 861 607 865 350 316 969 401 219 292 727 571 639 249 36 895 387 520 16 822 475 412 698 630 445 908 354 4...

output:

713091108675
426281318420
2380546679683
162276063594
592555799923
79654472906
2119409590502
5210913063012
12857902539
4391511068477
196432244783
40852510848
90876979671
17298056957
2543797918409
252733073586
2207469070715
978517431729
380104705657
4199650036085
2358087806
146323734524
956586725507
5...

result:

ok 50000 lines

Test #146:

score: 0
Accepted
time: 321ms
memory: 7908kb

input:

300000 50000
788 2644 3544 4073 1318 3848 2944 2542 2824 1823 3704 18 2866 2229 2026 1859 445 1982 120 2274 4796 1806 1886 1644 1556 469 223 3896 3324 66 1705 4717 2097 2454 874 4720 1097 1299 4108 3136 1480 1352 4817 1119 2677 2687 3561 123 3476 4839 1370 552 1698 2972 303 745 443 2255 3700 2743 22...

output:

8888851632036
28299937950
7396991092153
156534108546
388666813346
11957012430182
160035775157
22444535058452
1971249306928
17241403328951
20089182929974
8227947138108
4046811980412
833796005903
28351525470032
8408094489462
11376197646740
661639916290
794027397773
11098224358472
9808225407015
9313061...

result:

ok 50000 lines

Test #147:

score: 0
Accepted
time: 315ms
memory: 6212kb

input:

300000 50000
77 2355 1023 1315 4965 2266 1390 2329 868 3067 625 4714 2088 2068 1491 4598 4670 1317 1074 705 2744 1252 1200 4138 4330 2125 705 4749 980 1557 4785 3113 3885 653 3342 4384 2243 180 4987 249 1106 1385 647 1200 4238 3619 233 144 291 4529 3002 2365 1298 3959 1154 2646 2088 1087 672 2168 32...

output:

408248423591
1883530434968
73085059605
228716546847
16314664976654
5980607935907
1881342657737
21085885605987
31178190592672
14853895424786
3790273710953
1997495487621
995927353900
98921128508
3905797111004
35798679028748
20632635326396
28835438823186
12331388484165
5490258032139
10083161175146
3260...

result:

ok 50000 lines

Test #148:

score: 0
Accepted
time: 330ms
memory: 7748kb

input:

300000 50000
592 966 4609 2526 2698 2883 2841 4505 3198 1867 1677 4541 2971 1466 2171 1754 3953 4075 4814 3959 2565 416 1010 1790 3101 3067 3270 4680 3121 832 1762 2969 1092 4463 2941 2479 1653 677 66 4618 711 2427 2655 3425 2227 1602 4503 1314 4687 3877 943 2499 4734 4864 2195 3841 4768 2222 1049 4...

output:

11666978350639
20662319007283
8465030878873
2497817351483
18644290015300
20747496483240
22670698169826
1766179022977
2476477773183
11863553056410
8739358656080
9116181078698
1847230246173
49221162701
5565032158818
4339266224608
11703634100239
6245574751
4760496646246
1509187728926
6753032802096
1720...

result:

ok 50000 lines

Test #149:

score: 0
Accepted
time: 314ms
memory: 7936kb

input:

300000 50000
3022 706 2117 2359 1703 435 4666 4182 454 3533 24 3561 2054 2378 822 4356 120 3430 639 1257 2111 2620 1298 1047 2724 732 989 1512 1819 1087 4949 2101 4215 2113 4993 196 1044 3297 1533 4353 575 1760 2384 2057 2182 2312 418 4801 4234 998 681 1791 2910 2309 2601 4650 1761 1151 881 4284 416...

output:

503644918769
2703232548690
5655607839113
1469487151290
10281677783277
21022786754607
8990238389294
5256553447035
900028929977
30787010613922
30240542464727
225857512091
2242612409825
4045636933679
2948548518476
1934245495
10212978149
1562089143491
13611474750989
13403523660856
307217540642
482776380...

result:

ok 50000 lines

Test #150:

score: 0
Accepted
time: 323ms
memory: 7688kb

input:

300000 50000
1138 3533 1221 1374 632 703 3009 3299 4889 4293 245 3699 4185 2086 4435 4430 54 4295 4260 4796 2528 4065 1187 3423 4428 4302 2791 905 3 4784 3345 2466 4741 1770 2152 4937 2511 3215 685 1001 3840 186 1614 2942 3868 2877 3033 3625 3122 2254 4804 1507 4937 4722 4615 2072 753 593 1415 2819 ...

output:

2503553596492
26520048497471
45032298309
12442793401832
160200423491
5560353266212
6343639488030
29583484735741
1812956659779
1452464015282
195562154999
33996053285
12218970856992
36428048959268
400737364092
4760223903713
4169396220166
11377412299872
13049154300737
38743770295925
22856041668
1160558...

result:

ok 50000 lines

Test #151:

score: 0
Accepted
time: 249ms
memory: 7648kb

input:

300000 50000
5358 6110 4110 1931 525 7930 9569 3733 1663 8678 9208 1984 4660 2221 5208 8596 9901 1305 3213 1102 2399 3042 7959 353 238 1168 2874 4741 9560 9517 8482 8704 6600 6447 1101 2466 395 1363 961 8439 2869 1801 484 2181 2948 5480 2402 8651 9116 7020 8507 7233 7380 9677 963 5715 7755 1999 1124...

output:

4553959700008
24643787242282
12090000660889
25301015269796
18521768740624
2425794125952
331227552504
36876681896855
74913182439007
2174656613428
11457133053601
76772232900159
43946456036617
15512149817077
130906235898
2910042176888
16503702185375
480936929638
7033295428201
5863277547758
4023123391
9...

result:

ok 50000 lines

Test #152:

score: 0
Accepted
time: 252ms
memory: 7648kb

input:

300000 50000
8884 3014 52 1057 2783 4390 3774 583 8252 6600 2519 7542 3074 799 2739 1420 765 9750 3387 1466 5172 770 4872 5652 2672 4660 8984 8964 3121 1348 2366 7015 9553 7609 772 2615 4984 9976 6244 8868 6212 4483 6625 8445 1380 728 9462 4669 3295 6968 2075 5023 5785 4872 8156 4100 674 881 6189 44...

output:

3080444108
9431392924592
41235958434791
28117639383
40180156705731
35962360039270
9407825372983
8112095603413
21879823188923
45121715405006
26253653039
13779944601215
7286105522474
2714347863459
1515668524
1165558165004
3526601112410
14122846368220
49819472674625
7536354671703
1875017635679
13433059...

result:

ok 50000 lines

Test #153:

score: 0
Accepted
time: 265ms
memory: 6168kb

input:

300000 50000
3780 9114 8151 7338 2798 6987 807 3349 4902 3008 9381 1122 6607 8333 2881 4943 5887 1845 3696 3912 291 3822 4312 6121 8525 3 817 2919 9675 7437 7053 6168 156 4328 3646 7283 4037 5859 6070 7963 7142 91 1270 9606 9129 3095 9896 6289 235 9749 8773 296 8857 5192 2149 3695 2223 8470 5567 174...

output:

3145484375037
7918634152345
13726172801
12841041466128
6305751973816
5152863187963
18924860210505
154336901448
36737130695132
89394297
1905820041978
812842985057
15682794980780
29233123412904
3752301271744
1885289483355
3126588118774
46234675094816
43476046704929
7436635142348
3758709113660
23728581...

result:

ok 50000 lines

Test #154:

score: 0
Accepted
time: 256ms
memory: 7760kb

input:

300000 50000
7445 6489 3352 9281 186 5514 9237 3405 3467 5716 1714 5990 2873 5187 312 1116 8307 2269 7421 6412 4420 3483 5148 8665 8779 9530 1933 2742 401 2883 4225 8248 7178 4091 9383 7753 6659 5067 1049 7500 8738 6358 8240 6005 4279 4140 8504 5523 4726 5864 6692 3531 8044 6940 5513 9630 207 5209 1...

output:

9674711692730
47942244548631
18680600331440
73526247458703
54896994016544
53821792001
32284827123
5477822087637
19827003828036
50440587158635
55538449144069
26244488660712
18262104128167
405968700697
63373454965252
6780434010139
21789147818891
3650367517811
20869330533343
108817616757
57869920096669...

result:

ok 50000 lines

Test #155:

score: 0
Accepted
time: 253ms
memory: 7696kb

input:

300000 50000
1742 6164 9834 8329 566 7846 4520 1961 9753 6572 9153 9265 517 2951 9010 1630 1750 9895 7053 5002 4003 1492 8115 4785 402 6719 5333 678 2958 2963 5663 820 1439 5654 8431 5560 9699 305 9920 8173 262 378 1677 4339 4249 8186 4024 5156 826 9969 5277 1555 8770 7946 2332 5561 6591 3493 6326 3...

output:

3849788623379
6879318677622
10280384730866
3759953196176
76224473623247
24007761400403
17460359340489
61301729021624
103818535774
3905799730
3011644251803
1127782252479
25440229107315
203374746670
556663125105
37174982590293
8612613663403
8311551403719
4244803895395
10405226108145
35933464111812
153...

result:

ok 50000 lines

Test #156:

score: 0
Accepted
time: 815ms
memory: 8088kb

input:

300000 50000
5 175824 168539 50050 187022 50092 159937 159498 169381 192938 50135 172837 197813 50002 194518 50451 186438 50497 50049 178522 174459 50288 177315 50076 50282 50359 5 50151 4 153178 181976 3 171241 181720 4 182895 152946 195479 50175 161905 1 154601 157938 199835 191846 188966 50288 18...

output:

9243825750207
44415496078975
4000939531255
3164062283501
6736719987533
226850599114
39639689926190
13863192397902
91379802739990
52292524469448
85060462178823
114227351062143
29032697408360
4510389486648
248371599536379
23983948826281
9080683066041
1038220905259
1781439875
40656982471943
19836959732...

result:

ok 50000 lines

Test #157:

score: 0
Accepted
time: 814ms
memory: 7816kb

input:

300000 50000
50470 154428 180341 156707 50357 182558 183512 182913 50495 170564 2 152947 189778 177716 196476 190070 1 167615 4 164295 50185 50035 50056 183129 50049 182267 50387 197709 162917 50156 1 50188 1 174522 50138 4 1 190698 195950 1 50450 50264 1 184961 164234 50120 50381 50033 50424 1 1977...

output:

2090184293928
6846159303066
10906787019446
40942746860594
243785938975796
29854425816736
28292080726534
18596116132297
105626573895930
31683552251840
1865209167041
24189774275259
34936819537783
49238842774266
220473637910727
96292826533627
84923654105053
106698093429
59577667719870
2235179976
165560...

result:

ok 50000 lines

Test #158:

score: 0
Accepted
time: 823ms
memory: 6408kb

input:

300000 50000
3 2 50388 50268 50385 50264 194458 153086 50489 158768 195644 185659 186458 3 50182 161327 179668 50339 50364 173861 170376 50440 181604 50271 2 3 50365 163372 5 50480 175093 171660 164195 50179 3 50358 2 181717 5 175112 169241 151781 3 50396 177112 151915 50013 156519 50104 50257 18567...

output:

3791136423264
134211708433461
30593368059574
20468755756800
234119263877563
90252356103263
3962702848024
35302385778397
32504661165673
569451816932
21546955163
2662638475442
39177029449804
60432212051245
159631500533857
877995247527
8138270317520
121166439728507
884464420691
121808939
20551331049786...

result:

ok 50000 lines

Test #159:

score: 0
Accepted
time: 808ms
memory: 6344kb

input:

300000 50000
162240 50448 5 50265 50088 189056 180091 50018 178442 176077 182430 162319 50196 50211 50260 182045 176781 187120 197088 164326 155475 50004 162710 192446 50395 182068 50456 178577 50364 173392 172350 2 155276 159068 50453 2 50041 167861 178701 196593 50297 171334 50259 195408 176774 50...

output:

4751739376975
118171695880124
50557717901304
165852198839994
10497080548646
1755252782529
698330879
11223052241027
1266810361671
101272054350
75966218214642
215973292666319
45507562514265
48203054100
6277704819794
2035055961666
82596598691616
63633239739051
708826624910
7456725389025
4735730985
1126...

result:

ok 50000 lines

Test #160:

score: 0
Accepted
time: 814ms
memory: 6152kb

input:

300000 50000
50184 50321 167455 50056 168906 50264 158491 191497 50040 5 157750 50432 5 187636 195647 161062 50380 177237 50072 192569 157840 50072 177638 50180 50456 50332 50019 188115 187328 194364 171029 184196 5 153786 192205 5 179752 161219 2 2 5 50217 50484 183652 151658 50208 2 153459 184045 ...

output:

25954600755650
13248906119657
47607053792440
21755556277301
87814928236862
52460793275146
388639619201
240814664613396
112757172779602
17624603109957
201684057395349
8079761674968
3309276227169
1977045828101
13961674999224
52991048101
20142919977819
86149559350
8654148470370
64231943111390
358010569...

result:

ok 50000 lines

Test #161:

score: 0
Accepted
time: 551ms
memory: 8080kb

input:

300000 50000
22817 180001 180008 180001 180002 29757 13878 5587 180002 180001 21801 3843 180002 180001 180002 4108 180004 13669 20150 18795 180001 28201 180002 180004 180007 180001 27530 180009 180004 22371 180001 180001 25736 22260 27427 28749 5017 4710 180005 8726 180002 180004 180006 24842 180009...

output:

65906260363610
39545637358107
116059891509068
34182683708895
49244756041242
58043518210280
10569034569311
6938162205769
41065827477911
82977328325370
70539910104870
149517111475862
18629071076444
12874158601911
3886541814859
2073795311879
2115359244786
4168423328043
14827588555704
17763657293155
170...

result:

ok 50000 lines

Test #162:

score: 0
Accepted
time: 547ms
memory: 6360kb

input:

300000 50000
180002 180007 180006 180007 26117 180007 26268 3292 180001 180008 28827 2740 26770 180006 6972 180007 5004 3819 180001 8797 17125 180008 9181 3843 3641 180006 1338 29838 180006 22433 180009 180006 180006 180007 6524 18369 180006 12387 980 180002 180006 16628 20581 18154 180007 27205 180...

output:

3153896850285
508075604235
16870722038744
7286120838654
491103620070
34591443316365
37810561097739
1034509318870
6684238702105
67841543139795
77772712737768
3188887917059
14037344069739
65946365303895
22907514172369
4270930292915
59223267649
315873677208
8311389437205
1892639092443
27969951049
12196...

result:

ok 50000 lines

Test #163:

score: 0
Accepted
time: 547ms
memory: 7960kb

input:

300000 50000
15428 9144 2848 180006 14434 180001 19151 18594 25668 24602 3500 180006 180007 12691 180006 180001 7673 19120 16706 180005 27888 15853 7193 180004 180010 18743 761 180007 8085 27373 29937 18165 180005 180010 24248 4536 7814 180006 12760 180001 180001 3853 180005 180005 180005 180005 151...

output:

14784218546454
154014333485
4956621668162
5309515385867
37438763484994
11269707455830
4729526380722
2750133612929
22237668387658
245757372
72974122180067
32968463354
8106647511
71466382321
23446780909103
2449597679935
280492956304
31569895078228
22049839667448
1556828014851
26595822566888
8607303951...

result:

ok 50000 lines

Test #164:

score: 0
Accepted
time: 548ms
memory: 6184kb

input:

300000 50000
8523 180003 180003 11960 180010 29290 4266 17829 14278 17334 24227 11882 10416 11451 11982 180002 180005 22717 1868 4247 180001 10552 180002 180005 29387 3998 180001 11009 180003 180002 180003 5599 750 12294 180010 180010 180001 9867 180002 180002 180010 7127 180008 180003 8250 24499 27...

output:

45833956055154
3644592497419
571185328994
24103553919
3318213310345
20891751308686
373895863194
742738445258
1653868747955
125894274156174
118237598624483
29381979070082
3506439234710
38268190399843
4779645634220
13183466614766
68027098489860
528311488512
16041298168442
7989805927354
57602299081584
...

result:

ok 50000 lines

Test #165:

score: 0
Accepted
time: 551ms
memory: 7912kb

input:

300000 50000
8242 180010 180006 26088 16392 20198 22284 180010 12601 25916 29693 241 180005 180010 21690 14144 180001 8297 180001 180010 180005 180005 20537 23128 180002 24268 13371 18314 180002 180005 15927 525 4030 180005 10472 15177 14496 180001 21629 180004 180002 14294 28640 22751 180005 180005...

output:

37629798079609
462052303959
12590886908250
381718380061
11711682418907
10260461096424
13432441298762
2693637109052
1873024489155
1089097413177
820090711
17500810528788
248661776578
8316000998003
655630114
5706868106840
1213193138012
18513445770498
16786277277385
6977424897654
13476795477699
24903403...

result:

ok 50000 lines

Test #166:

score: 0
Accepted
time: 899ms
memory: 7836kb

input:

300000 50000
150040 150040 192 137 229 764 771 150040 150027 422 150020 150040 150003 150023 150004 150007 424 686 359 150011 808 444 288 150032 150048 150016 150040 512 150025 150023 666 375 150040 150008 150010 150027 927 460 150040 150001 150028 463 150048 150007 150033 150015 720 579 498 150021 ...

output:

1296389466475
9866687452
549429484722
6214863963
71351597567
504432826383
2313317835269
663203953997
263806565429
9645841345
4580858985714
125472907801
1197525934982
391087358467
333282023772
11815677610
1643722766809
69941061613
111067233461
3713106775474
890003344668
1558365833666
1976318936953
19...

result:

ok 50000 lines

Test #167:

score: 0
Accepted
time: 908ms
memory: 5788kb

input:

300000 50000
900 423 784 150029 150021 234 150047 220 150011 610 150029 150031 331 499 144 436 434 150047 150021 907 150021 150035 378 903 150006 550 150036 330 150039 150038 276 505 550 150023 150035 997 150005 742 150021 150046 811 150026 946 503 158 36 466 513 150043 598 150034 311 316 332 150028...

output:

3604182767073
431407775533
2982483893187
570001593361
48655109151
1487467673360
2670434404963
2797430137152
2023840095173
380574189845
54614238990
621773219423
305495545338
297323436209
1340990215056
57087646096
1764912229291
3513790658572
817945895153
3776771512248
1218271377472
44758504352
9222036...

result:

ok 50000 lines

Test #168:

score: 0
Accepted
time: 901ms
memory: 7748kb

input:

300000 50000
482 150017 150042 150042 981 150039 150036 707 150027 150041 150035 150027 331 150029 150008 356 440 346 730 518 150009 150012 224 150037 150012 150042 150017 150045 474 150041 571 8 150035 479 150031 839 270 586 150033 150040 392 150003 44 869 553 150008 630 150042 554 544 150043 15004...

output:

259126705747
2465703608500
2016408203874
30588224483
1727670673590
241226493479
417623191865
264379234215
354673071502
247698597084
293065314135
384697572499
41781693791
2394540571079
75503554910
61468291416
74279843124
4921979871629
2535947072583
766389700251
1595867505498
230979953865
359490848547...

result:

ok 50000 lines

Test #169:

score: 0
Accepted
time: 893ms
memory: 7856kb

input:

300000 50000
150018 150021 592 196 150013 84 150001 673 174 150018 150046 150009 150046 150001 110 150003 865 229 150039 150003 150046 331 150025 150047 150003 696 779 150029 404 150018 459 688 381 150001 150022 150003 150017 150003 150001 356 648 150013 804 411 150046 458 150025 520 919 461 238 150...

output:

540013557416
2060149911955
785653687103
66666828363
1453341732028
194917916318
2793395612417
479428681084
653932836043
3920955796248
336050584109
104252925421
3849592936001
707040478415
3014692299260
1276826023
195614531075
365122655479
1051777414331
867349723737
361304715235
3888664189938
275503584...

result:

ok 50000 lines

Test #170:

score: 0
Accepted
time: 902ms
memory: 8000kb

input:

300000 50000
18 150020 684 833 150022 251 644 150017 150021 178 150028 150027 150006 150028 150020 694 150043 503 150049 150013 150050 371 150030 302 924 150028 177 150014 889 872 150050 150031 466 150042 150002 63 150008 150009 150009 276 150034 150022 232 150023 382 129 450 422 150009 677 8 522 15...

output:

149649067248
1260409181292
1076350836793
83635016217
570731943580
598838663875
1398876740472
566056203440
824802777645
1296851896896
292009904680
2944630011750
2842394528236
1025027514168
35191847
115822701719
636742245240
2374890003303
1717114644535
312242842781
137102970510
510786893698
2065230611...

result:

ok 50000 lines

Test #171:

score: 0
Accepted
time: 860ms
memory: 5912kb

input:

300000 50000
120015 120023 40 115 8 24 55 120036 120008 281 120017 120024 120010 14 94 205 120012 50 66 120032 195 6 120005 120035 120039 120026 120023 29 266 120015 311 249 293 133 120016 120004 120022 120026 36 120022 120023 120029 120008 120039 120011 120006 157 120030 175 120032 120002 120039 12...

output:

329119422362
111897465970
23506677220
739259176797
118733181690
66588451438
322570946978
307592503588
699254210010
2578068001
93910039618
170294273690
307476901338
254297985165
19666843913
485557829301
441271795462
459852699859
268297462539
1089920782000
892219131857
4643422802
2660456761
3299104668...

result:

ok 50000 lines

Test #172:

score: 0
Accepted
time: 853ms
memory: 7712kb

input:

300000 50000
326 120006 120032 250 182 120015 235 195 120034 120031 120019 154 100 105 120020 120033 120010 120036 120028 120013 120025 392 120031 120005 36 120020 144 120009 120025 120005 208 120034 120007 292 213 182 120037 355 120028 120030 120017 32 94 396 316 120033 120031 200 120031 120002 120...

output:

760182745454
568592378738
174250535137
3760025849
1090335998051
698397717689
200249488182
18828214702
75796729608
134379198807
176466096717
39512957061
17359339323
944933904579
312384526891
677523859
316329503684
518079959657
1721192543085
342791621838
340873023318
7909765646
622433084535
1160126726...

result:

ok 50000 lines

Test #173:

score: 0
Accepted
time: 856ms
memory: 7760kb

input:

300000 50000
120010 319 120031 120025 120019 183 120029 31 398 228 115 120035 120006 120035 312 21 120031 273 120031 120025 120015 120017 125 388 120033 120035 120031 120035 120025 120006 120024 120010 120019 120039 120040 120029 120037 120020 52 120037 120013 150 47 21 120039 326 120006 120030 1200...

output:

686788290549
995982367489
315049469646
681456365766
12372419611
1760383678322
363092148239
20461473015
60569717796
5393383782
871490186483
1330438102200
1110561080
1570180896749
237161557834
8123734948
580421238722
717703466506
1202160850401
484137543804
274399003188
11141022807
8938128690
114799975...

result:

ok 50000 lines

Test #174:

score: 0
Accepted
time: 843ms
memory: 5884kb

input:

300000 50000
318 318 120005 339 120020 120005 120021 120030 120022 120021 120038 120021 120004 120022 22 120034 98 66 109 120032 83 368 240 302 120007 120022 120007 120030 343 130 159 120023 39 120035 120036 120014 46 120022 365 20 188 120022 120021 120032 252 120032 317 120001 310 120012 252 361 76...

output:

5510403150
1780394963006
2037589320
394354710039
43689335346
15741080
44422027861
1171871679344
393672404629
89725528553
11082405360
669130158728
637782871
193068175285
422724880682
602308892
130299546234
197329691059
148016459957
46076050127
42795703418
196950740627
256836693092
1299952723838
34227...

result:

ok 50000 lines

Test #175:

score: 0
Accepted
time: 864ms
memory: 7856kb

input:

300000 50000
120013 120035 120002 120002 290 120037 120029 120029 173 120030 120002 292 120035 120008 388 275 386 120034 120016 308 31 218 138 120008 120001 120005 120009 366 303 120037 120026 120028 39 120002 120004 120029 120037 120038 120002 120032 120027 120038 120004 120040 321 120007 120008 12...

output:

764600297328
52853303875
43814613188
51270123209
16934875008
693144991715
2055339339609
30270466715
331502022188
46758657596
1467542349
46347864979
101902209587
463924779436
268269428
291953331973
1616533387701
324286905302
100531414134
875864454831
199813802046
811202209663
606370622102
70804290
15...

result:

ok 50000 lines