QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#487174#4929. Longest Unfriendly SubsequenceZhangYiDe20 49ms4632kbC++11824b2024-07-22 17:25:252024-07-22 17:25:25

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 14ms
memory: 4396kb

input:

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

output:


result:

wrong answer 1st lines differ - expected: '1', found: ''

Subtask #2:

score: 0
Wrong Answer

Test #15:

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

input:

3
5
1 2 1 2 1
7
1 2 3 2 1 2 3
8
1 10 10 1 1 100 100 1

output:

2
6

result:

wrong answer 3rd lines differ - expected: '4', found: ''

Subtask #3:

score: 0
Wrong Answer

Test #19:

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

input:

1
500
537076440 691668159 871942500 537076440 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 537076440 6916...

output:


result:

wrong answer 1st lines differ - expected: '361', found: ''

Subtask #4:

score: 10
Accepted

Test #79:

score: 10
Accepted
time: 11ms
memory: 4552kb

input:

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

output:

66691

result:

ok single line: '66691'

Test #80:

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

input:

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

output:

66403

result:

ok single line: '66403'

Test #81:

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

input:

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

output:

113082

result:

ok single line: '113082'

Test #82:

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

input:

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

output:

98984

result:

ok single line: '98984'

Test #83:

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

input:

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

output:

66809

result:

ok single line: '66809'

Test #84:

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

input:

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

output:

66929

result:

ok single line: '66929'

Test #85:

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

input:

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

output:

165153

result:

ok single line: '165153'

Test #86:

score: 10
Accepted
time: 14ms
memory: 4444kb

input:

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

output:

161302

result:

ok single line: '161302'

Test #87:

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

input:

3
14732
1 3 2 1 3 3 1 1 3 2 1 2 1 1 1 3 1 3 1 1 3 2 1 1 3 2 3 3 2 1 3 3 3 3 1 1 1 2 3 2 1 3 3 3 1 2 1 1 3 1 1 2 2 1 3 3 3 2 3 2 1 2 2 3 1 3 3 2 2 3 1 2 1 1 3 2 2 2 1 2 3 3 1 3 3 2 1 1 1 1 2 1 3 1 2 3 3 2 2 1 3 3 3 2 2 2 1 1 1 1 1 2 1 2 1 3 2 2 1 3 2 3 2 3 3 1 3 1 1 2 1 1 2 1 1 3 2 1 2 3 2 1 3 1 3 3 ...

output:

4957
130118
23430

result:

ok 3 lines

Test #88:

score: 10
Accepted
time: 14ms
memory: 4104kb

input:

3
46973
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 ...

output:

35431
19615
37542

result:

ok 3 lines

Test #89:

score: 10
Accepted
time: 12ms
memory: 4156kb

input:

3
19336
2 3 1 2 2 3 1 1 2 3 3 1 2 2 2 3 3 3 1 2 3 1 2 2 3 3 3 1 1 1 1 1 2 2 3 3 3 3 1 1 1 2 2 2 2 3 1 1 1 1 2 2 2 3 3 3 3 1 1 2 2 2 3 1 2 3 1 2 2 3 3 3 1 2 3 1 2 3 1 2 3 3 1 1 2 3 3 1 2 2 2 2 2 2 3 3 1 2 3 1 2 2 3 3 1 1 1 1 2 3 1 1 1 1 1 2 2 2 2 2 2 3 3 3 1 2 3 1 2 3 3 1 2 3 3 3 3 3 3 1 2 2 2 2 2 2 ...

output:

8087
53502
40182

result:

ok 3 lines

Test #90:

score: 10
Accepted
time: 14ms
memory: 4240kb

input:

3
111453
2 3 2 2 3 2 2 2 1 1 1 2 2 2 3 2 2 1 3 1 3 3 1 3 2 2 1 3 1 2 2 2 3 1 3 2 1 2 1 1 3 3 1 1 3 1 1 2 1 2 1 1 1 3 3 3 1 1 1 3 2 2 1 3 2 1 1 3 1 2 3 3 1 2 2 2 1 3 2 2 2 2 2 2 2 3 2 1 3 1 2 1 3 1 1 1 2 3 3 1 3 2 1 3 2 2 2 3 1 3 3 3 2 1 3 2 1 3 2 1 3 3 3 1 1 2 1 2 1 3 2 2 2 3 3 1 2 1 2 2 3 3 2 2 2 2...

output:

37432
9380
2

result:

ok 3 lines

Test #91:

score: 10
Accepted
time: 8ms
memory: 4476kb

input:

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

output:

161232

result:

ok single line: '161232'

Test #92:

score: 10
Accepted
time: 14ms
memory: 4628kb

input:

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

output:

177380

result:

ok single line: '177380'

Test #93:

score: 10
Accepted
time: 10ms
memory: 4588kb

input:

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

output:

152945

result:

ok single line: '152945'

Test #94:

score: 10
Accepted
time: 11ms
memory: 4492kb

input:

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

output:

139711

result:

ok single line: '139711'

Test #95:

score: 10
Accepted
time: 11ms
memory: 4580kb

input:

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

output:

159913

result:

ok single line: '159913'

Test #96:

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

input:

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

output:

164070

result:

ok single line: '164070'

Test #97:

score: 10
Accepted
time: 14ms
memory: 4592kb

input:

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

output:

141972

result:

ok single line: '141972'

Test #98:

score: 10
Accepted
time: 14ms
memory: 4448kb

input:

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

output:

180569

result:

ok single line: '180569'

Test #99:

score: 10
Accepted
time: 26ms
memory: 4240kb

input:

3
67258
1 3 2 1 3 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 2 1 3 2 1 ...

output:

55713
10294
102575

result:

ok 3 lines

Test #100:

score: 10
Accepted
time: 9ms
memory: 4156kb

input:

3
110746
2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 2 3 3 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2...

output:

78787
56073
17413

result:

ok 3 lines

Test #101:

score: 10
Accepted
time: 14ms
memory: 4196kb

input:

3
88522
1 2 2 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 3 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 3 1 2 3 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 1 2 3 3 1 1 1 2 3 1 2 3 1 ...

output:

72954
15040
67627

result:

ok 3 lines

Test #102:

score: 10
Accepted
time: 14ms
memory: 4056kb

input:

3
38399
2 1 1 3 2 1 3 2 1 3 3 3 2 1 3 2 1 3 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 1 1 3 2 1 3 2 1 3 3 3 2 2 2 1 3 2 1 3 3 2 1 1 1 3 2 1 3 2 1 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 ...

output:

27852
58832
74901

result:

ok 3 lines

Test #103:

score: 10
Accepted
time: 14ms
memory: 3920kb

input:

10
23759
3 2 1 2 1 2 1 2 2 2 2 1 1 1 3 1 3 1 3 3 2 1 1 3 3 2 3 2 2 1 3 2 3 3 2 1 3 1 2 3 3 3 2 1 1 3 3 1 2 3 3 2 3 3 1 2 3 3 2 2 1 2 3 2 3 1 1 3 3 3 2 3 3 3 1 1 3 2 3 2 2 3 2 1 1 1 1 2 1 3 3 1 3 2 3 3 1 3 3 1 1 2 3 1 3 2 3 3 2 2 3 1 3 3 2 3 1 3 2 3 3 3 1 2 3 2 3 1 3 1 3 2 2 3 3 2 1 2 2 2 3 1 2 2 2 2...

output:

8049
15976
3898
1817
4647
15431
43707
2827
2372
17780

result:

ok 10 lines

Test #104:

score: 10
Accepted
time: 14ms
memory: 3820kb

input:

15
3978
2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 3 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 1 2 3 3 3 1 2 3 1 ...

output:

2648
2
12485
3542
2427
2686
13541
17826
1973
10284
16751
13183
2992
4312
643

result:

ok 15 lines

Test #105:

score: 10
Accepted
time: 14ms
memory: 3840kb

input:

20
2162
3 2 3 1 2 2 3 3 1 1 1 2 2 2 3 3 2 2 1 3 2 1 3 3 3 3 2 1 2 1 1 1 3 1 1 2 2 1 2 3 3 2 3 1 1 1 1 3 3 1 3 3 1 1 2 3 3 1 2 2 3 3 2 3 2 3 3 2 2 2 1 1 3 3 2 2 1 3 3 2 3 3 1 1 3 2 2 2 1 2 3 1 3 3 3 1 2 2 2 1 1 1 2 2 3 1 1 3 3 1 3 2 3 1 1 1 2 1 3 1 3 3 2 1 1 2 1 1 3 1 1 2 2 3 2 2 2 1 3 3 3 3 3 2 1 1 ...

output:

754
605
5276
265
12917
210
69
4263
11833
610
2550
5415
3601
12242
4287
5965
1729
16708
1764
1028

result:

ok 20 lines

Test #106:

score: 10
Accepted
time: 14ms
memory: 3780kb

input:

50
3286
2 3 1 2 2 1 2 1 2 2 1 1 2 3 2 3 3 1 3 1 1 1 1 3 3 1 3 3 3 1 2 2 2 2 1 1 1 2 3 1 2 1 2 1 2 3 1 3 1 1 1 1 2 1 3 1 2 2 1 2 1 2 3 3 1 2 1 2 1 2 1 2 2 2 2 2 1 2 3 1 2 1 1 3 2 3 1 1 3 2 1 2 1 1 1 2 2 3 1 1 3 1 1 2 2 3 1 2 2 3 2 3 3 2 1 2 3 3 2 3 1 3 2 2 2 3 3 3 1 2 3 3 3 3 2 3 2 1 2 1 2 1 3 1 2 3 ...

output:

1094
2039
1266
311
3566
734
3452
921
6366
1785
1886
46
250
1156
2209
480
856
891
1475
1903
98
1610
6239
2069
1169
4200
1325
2769
31
956
206
4259
6816
2833
474
3248
818
2818
1
398
160
54
1866
4308
3127
5468
1697
282
1209
1567

result:

ok 50 lines

Test #107:

score: 10
Accepted
time: 11ms
memory: 3768kb

input:

100
1
2
8738
3 3 3 2 2 3 2 1 1 2 2 2 3 2 2 1 1 3 2 2 3 2 3 1 3 3 1 3 2 2 1 1 3 2 1 1 3 1 1 1 1 2 2 2 2 1 3 3 2 2 1 2 1 2 1 1 2 2 1 1 2 2 1 2 3 1 1 3 2 2 1 1 3 1 2 3 2 1 3 1 1 1 3 2 1 3 3 3 2 3 3 3 1 2 1 3 3 1 2 3 2 1 3 3 3 3 1 1 3 2 1 1 2 2 2 2 2 1 3 1 2 3 3 3 2 1 3 3 1 3 2 3 2 1 2 3 1 1 2 2 3 3 2 2...

output:

1
2913
447
199
486
258
178
1822
6779
5048
3183
250
179
1857
719
194
98
510
6409
137
388
186
2
85
705
90
155
2627
766
203
413
550
1863
1
515
97
475
1
21
1282
1064
2382
471
276
557
137
112
225
185
921
1869
4
1877
84
353
1369
1175
717
2
507
1358
328
762
525
239
223
49
189
621
1229
427
911
830
2306
3726...

result:

ok 100 lines

Test #108:

score: 10
Accepted
time: 14ms
memory: 3740kb

input:

200
799
2 2 1 1 2 3 3 2 2 2 2 2 1 2 3 3 2 3 3 3 1 3 1 1 2 3 1 3 1 1 3 2 1 3 3 1 3 2 1 1 3 3 1 3 2 1 2 3 3 2 3 3 2 1 2 1 2 2 3 2 1 1 2 1 1 1 1 3 1 2 2 1 3 3 3 3 3 3 2 1 1 3 2 1 2 1 3 1 1 2 3 1 1 1 2 1 1 1 1 1 2 2 3 2 1 2 2 2 2 1 1 3 2 3 2 2 2 2 2 3 2 3 2 2 2 3 2 1 3 3 2 2 3 1 2 2 1 1 1 2 3 1 2 1 3 2 ...

output:

272
219
2
866
1052
234
752
479
66
608
263
503
2073
36
231
1498
315
29
116
514
589
168
905
15
985
18
148
657
2668
1219
580
210
1025
6
41
552
565
181
1702
386
371
154
25
268
2
466
75
151
26
1010
92
700
2157
594
2
1081
168
801
197
157
41
211
902
499
1177
465
101
95
142
500
616
200
51
244
172
630
83
918...

result:

ok 200 lines

Test #109:

score: 10
Accepted
time: 10ms
memory: 3776kb

input:

500
34
2 2 2 2 2 3 3 3 1 2 3 3 1 1 1 2 1 1 3 3 3 3 2 1 3 2 2 2 1 1 3 3 2 1
7
2 1 2 1 1 2 2
333
3 2 1 2 1 1 3 1 1 2 1 2 3 3 3 2 2 1 1 1 1 2 1 3 1 3 1 2 2 2 2 1 3 1 3 3 1 2 3 2 3 1 3 3 3 2 3 1 2 2 1 1 2 3 2 2 3 2 1 3 1 2 1 1 3 1 3 1 2 1 2 2 3 1 1 3 2 2 2 3 2 1 3 1 2 1 3 3 1 3 3 2 2 2 3 2 1 1 3 2 2 3 1...

output:

14
2
124
74
641
27
298
259
91
99
36
568
75
34
164
52
380
59
264
168
88
218
31
89
123
277
23
178
52
439
189
2
162
411
68
1733
348
2
52
354
38
265
10
179
2
80
222
46
298
207
69
547
83
77
117
110
19
414
237
97
111
88
89
36
139
214
266
429
37
629
129
169
42
22
4
84
91
32
231
43
141
168
336
49
40
248
6
4...

result:

ok 500 lines

Test #110:

score: 10
Accepted
time: 14ms
memory: 3676kb

input:

1000
294
3 3 1 1 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 1 2 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 3 1 2 3 1 1 2 3 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3...

output:

259
87
166
81
32
102
157
101
53
79
126
39
20
50
17
82
23
41
21
70
95
1
14
38
4
116
52
243
21
136
55
1
1
127
12
59
86
52
106
223
12
6
223
23
12
166
50
11
2
152
51
220
13
59
53
10
174
94
14
333
11
70
89
7
111
5
178
31
89
81
44
25
70
449
7
180
45
122
134
113
138
41
2
1
93
59
21
11
113
55
43
100
12
103
...

result:

ok 1000 lines

Test #111:

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

input:

10000
99
2 3 3 1 2 3 3 3 1 2 3 1 2 3 3 3 1 2 2 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 3 1 2 2 2 2 3 1 2 3 3 3 1 2 2 3 1 2 3 3 3 3 1 2 3 1 2 2 2 3 1 1 2 3 1 2 3 3 3 1 2 3 1 2 2 3 3 3 3 1 1 1 1 1 1 2 2 2 3 3 3 1 1 2
9
3 1 2 3 3 1 2 1 3
50
3 3 1 2 3 2 1 3 2 1 3 2 1 3 3 2 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 2 ...

output:

61
7
40
60
3
5
1
1
6
2
6
6
1
16
2
14
1
4
3
1
15
5
14
15
3
26
2
5
12
23
5
3
2
9
4
4
2
40
8
25
8
14
5
11
4
11
8
7
2
12
3
4
10
22
16
4
40
2
8
32
24
8
27
22
37
1
2
3
7
15
2
8
6
12
22
4
9
7
12
8
12
3
25
12
5
6
7
6
17
8
6
8
13
2
22
32
5
16
2
4
5
1
5
2
19
2
6
19
28
3
2
2
10
25
17
10
8
4
2
12
7
15
5
5
32
14...

result:

ok 10000 lines

Test #112:

score: 10
Accepted
time: 16ms
memory: 3816kb

input:

20000
9
3 3 2 3 2 2 3 1 2
9
1 1 1 2 2 3 3 2 3
5
2 3 2 1 1
6
2 2 1 2 3 1
7
2 2 2 2 1 3 3
1
1
8
2 1 3 2 2 1 3 2
14
3 3 1 3 2 3 3 1 3 1 3 3 2 3
5
1 2 1 1 1
5
3 2 1 1 2
9
3 2 1 1 1 2 3 1 3
7
1 1 2 3 1 1 1
1
2
5
3 2 1 1 2
29
3 1 1 2 2 1 1 2 3 3 3 1 1 3 2 1 2 3 3 1 3 3 2 3 1 3 3 1 2
6
3 3 1 2 3 1
12
2 3 1...

output:

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

result:

ok 20000 lines

Test #113:

score: 10
Accepted
time: 18ms
memory: 3844kb

input:

50000
5
3 1 3 2 2
1
1
1
3
6
2 1 1 3 3 2
9
3 3 1 1 2 1 3 2 3
1
2
8
2 2 2 2 3 3 2 1
2
1 2
2
3 2
2
2 1
1
1
2
1 3
3
1 3 2
6
3 1 1 1 1 3
4
2 2 2 3
6
1 1 1 2 1 1
3
3 3 1
15
2 3 1 2 3 1 2 3 1 3 2 1 3 2 2
1
3
4
2 1 3 2
2
1 2
4
1 1 2 1
2
2 1
2
1 3
1
2
5
3 3 2 2 1
5
2 3 3 2 3
3
2 2 1
1
2
6
2 3 3 3 3 2
3
2 1 3...

output:

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

result:

ok 50000 lines

Test #114:

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

input:

1
10000
2 3 3 1 2 2 2 3 1 1 2 2 3 3 3 1 2 3 3 1 2 3 3 1 1 2 3 1 1 1 1 2 2 3 3 1 2 2 3 1 1 2 3 1 1 1 1 2 2 2 3 3 3 1 1 2 3 1 2 3 1 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 1 1 1 1 1 2 3 1 2 2 2 3 3 1 2 3 3 3 1 1 1 2 3 1 2 3 1 2 2 2 3 1 2 3 1 2 3 1 1 1 2 3 3 1 2 2 2 3 3 1 2 3 3 3 3 3 1 2 2 2 3 1 2 ...

output:

4765

result:

ok single line: '4765'

Test #115:

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

input:

1
10000
1 1 2 2 1 2 1 3 1 3 3 3 3 1 3 1 1 1 1 2 1 3 3 1 2 3 2 3 2 3 1 3 1 3 1 1 1 2 1 1 1 3 3 3 2 1 2 1 3 2 1 3 2 2 1 3 1 2 2 2 2 1 2 2 3 2 2 3 3 2 2 3 2 1 3 3 1 3 3 3 3 1 3 1 1 3 1 3 2 3 3 3 3 3 2 3 3 1 1 3 1 2 2 2 3 1 1 1 2 1 3 2 2 1 1 2 1 3 2 1 2 3 3 2 2 3 3 3 3 1 2 1 3 2 3 2 2 1 1 1 2 2 2 1 1 2 ...

output:

3368

result:

ok single line: '3368'

Test #116:

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

input:

3
2025
1 3 3 1 2 3 1 1 1 2 2 1 2 2 1 2 3 3 2 1 2 3 1 1 2 1 1 1 2 2 2 1 3 1 1 2 3 1 1 3 3 3 2 2 2 2 2 2 1 2 3 1 3 3 2 2 2 3 1 3 3 3 3 3 2 3 1 2 1 3 3 1 3 3 3 1 2 3 2 3 2 2 3 1 1 1 1 3 2 2 3 3 1 1 2 1 3 1 1 3 1 2 2 1 1 2 1 3 2 2 3 1 1 2 1 3 1 2 3 1 3 2 2 3 3 1 3 2 3 2 1 2 2 3 1 3 2 2 1 3 1 1 3 1 2 2 2...

output:

694
953
2972

result:

ok 3 lines

Test #117:

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

input:

20
518
3 3 2 1 1 1 3 1 3 2 1 3 1 2 1 1 3 3 2 3 1 3 1 1 2 1 3 3 2 1 3 2 2 1 3 1 2 3 3 1 2 1 3 1 2 3 3 1 1 2 2 1 3 1 3 2 2 1 2 2 3 1 2 2 2 1 3 3 3 3 1 1 3 3 3 3 1 1 1 2 2 2 3 3 1 3 3 1 1 3 3 2 2 3 3 3 2 3 2 1 1 3 1 3 2 3 2 2 2 1 2 2 1 1 3 2 1 1 3 1 2 3 2 1 3 2 2 1 3 2 1 2 3 2 1 2 2 2 3 1 1 2 2 3 2 3 3...

output:

175
118
279
482
208
59
2
210
44
352
188
87
364
62
155
134
10
1860
418
227

result:

ok 20 lines

Test #118:

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

input:

100
75
2 1 1 3 3 3 2 1 2 3 1 3 1 2 3 1 1 3 2 2 2 3 1 3 2 1 2 3 2 2 1 1 3 1 1 3 3 2 1 2 3 3 1 1 2 2 3 2 1 2 3 3 1 3 1 3 1 2 3 1 3 2 2 2 2 3 1 2 3 3 3 3 1 2 2
130
3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3...

output:

34
114
22
85
85
8
102
19
93
18
30
41
60
17
2
91
204
35
35
16
64
3
2
20
18
27
17
29
47
31
13
11
10
13
36
4
117
22
1
65
13
2
6
24
106
67
1
64
33
206
1
45
14
2
32
304
74
2
21
5
68
25
53
18
93
55
2
54
109
20
25
163
130
35
35
23
9
113
30
77
108
203
18
9
33
47
9
1
44
33
3
204
98
158
3
173
254
3
59
20

result:

ok 100 lines

Test #119:

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

input:

1
10000
2 2 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 ...

output:

7601

result:

ok single line: '7601'

Test #120:

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

input:

1
10000
1 2 3 1 2 2 1 2 2 3 1 1 2 3 3 1 2 3 1 2 3 3 1 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 2 3 1 2 3 ...

output:

7746

result:

ok single line: '7746'

Test #121:

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

input:

1
10000
3 2 3 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 ...

output:

8313

result:

ok single line: '8313'

Subtask #5:

score: 10
Accepted

Dependency #4:

100%
Accepted

Test #122:

score: 10
Accepted
time: 28ms
memory: 4488kb

input:

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

output:

166092

result:

ok single line: '166092'

Test #123:

score: 10
Accepted
time: 25ms
memory: 4608kb

input:

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

output:

150827

result:

ok single line: '150827'

Test #124:

score: 10
Accepted
time: 28ms
memory: 4532kb

input:

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

output:

178728

result:

ok single line: '178728'

Test #125:

score: 10
Accepted
time: 28ms
memory: 4544kb

input:

1
200000
4 7 1 7 1 1 7 4 7 4 1 7 4 1 7 1 4 7 1 7 7 1 1 7 4 4 7 4 7 1 4 7 4 1 7 7 1 4 1 7 1 7 7 4 1 4 4 4 1 4 7 4 7 1 7 1 7 1 7 4 1 7 4 7 4 7 4 7 1 4 1 4 7 7 4 7 1 7 7 1 4 1 7 1 4 7 1 4 7 7 4 1 1 7 4 7 1 7 1 7 1 1 7 1 7 4 7 7 1 7 4 1 7 1 4 7 4 7 1 4 7 1 4 1 4 1 7 1 1 7 4 7 4 1 7 4 1 7 1 4 7 1 7 1 7 4...

output:

95820

result:

ok single line: '95820'

Test #126:

score: 10
Accepted
time: 28ms
memory: 4632kb

input:

1
200000
10 7 2 10 2 10 2 7 10 2 2 10 10 10 2 10 2 7 7 7 2 10 7 2 10 7 2 7 10 7 10 7 10 2 10 7 2 2 7 2 10 7 2 7 2 7 2 7 2 10 7 10 2 7 2 10 7 10 7 2 2 10 2 10 7 10 2 2 7 10 7 2 2 10 2 7 10 7 10 2 10 2 7 10 7 2 2 2 10 7 2 7 2 10 2 7 10 7 2 10 2 10 7 2 7 10 7 2 10 7 10 2 2 10 2 10 2 10 2 10 2 7 2 7 10 ...

output:

87271

result:

ok single line: '87271'

Test #127:

score: 10
Accepted
time: 27ms
memory: 4552kb

input:

1
200000
1 6 1 6 1 6 10 1 10 1 10 1 1 6 1 10 6 10 1 6 1 10 6 1 6 10 6 10 10 1 10 10 6 1 10 1 6 10 6 10 6 10 6 10 6 10 1 10 6 10 6 1 10 6 10 6 10 6 6 10 6 10 1 1 6 10 1 10 6 10 6 1 10 1 6 10 6 1 6 1 10 1 10 6 1 10 1 6 10 6 1 6 6 10 6 1 1 6 1 6 10 1 6 1 10 1 1 6 1 10 1 1 10 6 10 10 6 10 1 10 1 10 6 10...

output:

95918

result:

ok single line: '95918'

Test #128:

score: 10
Accepted
time: 23ms
memory: 4548kb

input:

1
200000
10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 9 3 9 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 10 6 3 10 3 10 3 10 3 10 3 3 10 3 10 3 10 3 10 3 10 3 10 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 ...

output:

16019

result:

ok single line: '16019'

Test #129:

score: 10
Accepted
time: 27ms
memory: 4576kb

input:

1
200000
4 5 4 5 4 5 4 4 5 6 5 4 5 6 4 6 4 6 4 6 4 6 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 6 4 6 4 6 4 6 4 4 6 4 6 4 6 6 8 6 6 4 4 8 6 4 8 6 4 8 4 8 4 4 8 8 4 8 4 8 4 8 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 4 8 4 8 4 8 4 8 4 8 4 8 4 8 8 4 8 4 8 4 8 4 8 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 4...

output:

14313

result:

ok single line: '14313'

Test #130:

score: 10
Accepted
time: 28ms
memory: 4480kb

input:

1
200000
5 3 5 3 5 3 5 1 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 3 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 6 5 3 5 6 3 5 6 3 6 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 10 3 5 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 10 3 10 10 3 10 3 10 3 10 3 10 3 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 ...

output:

15513

result:

ok single line: '15513'

Test #131:

score: 10
Accepted
time: 27ms
memory: 4556kb

input:

1
200000
7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 10 3 10 9 10 3 10 9 10 3 10 9 10 3 10 9 10 3 ...

output:

149344

result:

ok single line: '149344'

Test #132:

score: 10
Accepted
time: 27ms
memory: 4612kb

input:

1
200000
8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 1...

output:

149377

result:

ok single line: '149377'

Test #133:

score: 10
Accepted
time: 49ms
memory: 4580kb

input:

1
200000
2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 3 9 3 1 3 9 3 1 3 9 3...

output:

149345

result:

ok single line: '149345'

Test #134:

score: 10
Accepted
time: 24ms
memory: 4560kb

input:

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

output:

25620

result:

ok single line: '25620'

Test #135:

score: 10
Accepted
time: 27ms
memory: 4560kb

input:

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

output:

25827

result:

ok single line: '25827'

Test #136:

score: 10
Accepted
time: 28ms
memory: 4544kb

input:

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

output:

25640

result:

ok single line: '25640'

Test #137:

score: 10
Accepted
time: 27ms
memory: 4456kb

input:

1
200000
5 6 4 6 4 4 5 6 5 6 5 4 5 6 6 5 4 6 4 5 4 5 5 4 5 4 6 4 6 4 6 5 4 6 4 6 5 6 4 5 6 4 5 6 5 6 5 4 5 4 6 4 5 5 5 4 5 4 5 4 5 4 6 4 6 5 6 5 5 4 6 5 6 5 5 6 5 8 4 6 8 4 6 4 4 8 4 6 8 6 4 8 4 6 6 8 6 8 4 8 4 8 4 6 4 6 8 4 8 4 8 6 6 8 6 8 6 4 8 8 6 8 8 4 6 4 8 4 6 8 4 8 4 8 6 4 8 6 8 6 4 6 4 8 4 4...

output:

54939

result:

ok single line: '54939'

Test #138:

score: 10
Accepted
time: 27ms
memory: 4540kb

input:

1
200000
4 3 4 3 4 3 4 3 4 3 4 4 3 4 4 3 9 3 9 3 9 3 9 3 9 3 10 9 3 10 3 9 3 10 3 9 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 3 10 3 10 3 10 3 10 3 10 3 10 10 3 3 8 3 10 3 8 3 10 3 8 10 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 8 10 8 10 8 10 8 10 8 10 8 10...

output:

50710

result:

ok single line: '50710'

Test #139:

score: 10
Accepted
time: 28ms
memory: 4556kb

input:

1
200000
6 10 2 10 2 10 6 2 2 10 10 2 10 6 2 6 2 10 6 2 6 10 6 10 6 2 6 2 6 10 2 6 10 6 2 10 2 2 10 2 10 6 10 6 2 10 6 2 6 10 6 2 10 6 6 2 6 10 10 6 10 10 6 10 6 2 10 2 6 2 10 2 10 6 10 2 10 6 10 6 2 6 10 2 10 2 6 10 2 6 2 10 2 10 2 6 10 2 6 10 6 10 4 10 4 4 2 10 4 10 4 10 2 10 4 2 2 10 4 10 2 4 10 ...

output:

51364

result:

ok single line: '51364'

Test #140:

score: 10
Accepted
time: 23ms
memory: 4120kb

input:

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

output:

22591
34465
68516
25897
380

result:

ok 5 lines

Test #141:

score: 10
Accepted
time: 21ms
memory: 4112kb

input:

5
80502
3 1 7 1 3 1 3 7 3 7 1 3 1 3 1 7 3 1 3 1 1 7 3 7 3 1 3 1 3 7 3 1 7 1 3 1 7 1 7 1 7 1 7 1 7 1 3 7 3 1 3 7 1 3 7 3 1 3 7 3 7 3 7 3 7 1 3 7 3 1 7 1 3 7 3 7 1 7 1 3 1 7 3 1 3 7 3 7 3 3 7 3 1 7 1 7 3 3 7 1 7 1 3 1 3 1 1 7 1 3 7 1 3 7 1 7 3 1 7 3 1 7 3 7 3 7 1 7 3 7 3 7 1 3 1 3 7 1 3 1 7 3 1 7 1 7 ...

output:

39267
6856
16735
26256
6758

result:

ok 5 lines

Test #142:

score: 10
Accepted
time: 18ms
memory: 3956kb

input:

5
39449
3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 3 3 3 5 3 5 3 5 3 3 5 3 3 5 1 5 5 3 3 5 3 5 5 5 3 5 3 5 3 5 3 5 5 3 5 3 5 5 3 3 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 ...

output:

2639
3386
4659
334
2110

result:

ok 5 lines

Test #143:

score: 10
Accepted
time: 17ms
memory: 4284kb

input:

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

output:

4159
17937
96620
8083
21726

result:

ok 5 lines

Test #144:

score: 10
Accepted
time: 21ms
memory: 4076kb

input:

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

output:

3054
7918
8088
1992
2731

result:

ok 5 lines

Test #145:

score: 10
Accepted
time: 18ms
memory: 4320kb

input:

5
10441
5 6 5 6 5 6 5 6 5 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 7 7 7 6 7 6 7 6 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 4 7 4 7 4 7 ...

output:

2228
2939
7794
2791
17974

result:

ok 5 lines

Test #146:

score: 10
Accepted
time: 25ms
memory: 4008kb

input:

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

output:

51801
44778
7029
3998
50014

result:

ok 5 lines

Test #147:

score: 10
Accepted
time: 28ms
memory: 4460kb

input:

5
165460
6 7 4 7 4 7 4 7 7 6 7 7 4 7 6 7 4 7 7 4 6 6 4 6 7 6 4 6 4 6 7 6 4 7 6 4 7 4 6 7 4 6 6 4 7 6 7 4 7 6 4 6 7 4 7 4 6 6 4 4 6 7 7 4 6 4 7 4 4 4 7 4 7 4 4 6 7 4 7 4 4 7 7 6 4 7 6 7 4 8 6 8 4 6 6 8 8 8 4 8 4 4 6 4 6 4 8 4 8 6 4 8 6 4 6 8 4 6 8 6 4 6 8 4 8 4 6 8 6 8 4 8 6 4 6 8 4 6 4 6 4 6 4 4 6 4...

output:

71565
12332
1267
1638
987

result:

ok 5 lines

Test #148:

score: 10
Accepted
time: 27ms
memory: 3988kb

input:

5
21146
9 3 9 9 9 3 8 3 3 9 3 8 3 9 3 3 3 9 3 9 3 9 3 9 5 3 9 5 9 3 9 5 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 5 9 5 9 5 9 5 9 5 5 9 5 9 5 9 5 9 5 5 9 5 9 9 9 5 9 5 9 9 5 9 5 5 9 5 9 5 9 5 9 5 9 9 5 9 5 9 9 5 9 5 9 5 9 5 9 9 5 9 5 9 5 5 9 5 9 5 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 5 9 5 9 5 ...

output:

1582
4002
3180
2214
3804

result:

ok 5 lines

Test #149:

score: 10
Accepted
time: 27ms
memory: 4192kb

input:

5
27833
8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 6 3 6 7 6 3 6 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 7 3 7 6 7 3 7 6 7 3 7 6 7 3 7 6 7 3 7 ...

output:

20420
5045
74592
21902
26524

result:

ok 5 lines

Test #150:

score: 10
Accepted
time: 20ms
memory: 3932kb

input:

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

output:

7432
3252
8288
5140
448

result:

ok 5 lines

Test #151:

score: 10
Accepted
time: 28ms
memory: 4044kb

input:

5
17501
3 1 3 7 3 1 3 7 1 7 1 3 7 3 7 3 7 1 1 7 1 3 1 3 1 7 1 7 3 1 3 7 3 7 1 7 3 7 1 3 1 7 1 3 7 3 7 1 3 7 3 7 3 1 3 1 3 7 1 7 1 7 3 7 3 1 3 7 3 7 1 3 7 3 1 3 7 3 7 1 7 1 7 1 7 3 1 7 3 1 7 1 7 1 3 7 7 3 1 3 7 1 7 1 3 1 3 3 7 1 3 7 1 7 3 1 3 1 7 3 7 1 3 1 7 3 7 3 7 1 7 7 3 7 3 7 3 1 7 3 7 1 3 7 1 3 ...

output:

9594
22507
2017
9617
53924

result:

ok 5 lines

Test #152:

score: 10
Accepted
time: 28ms
memory: 3876kb

input:

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

output:

15570
5273
1147
2125
9270
22092
29594
32800
7667
35158

result:

ok 10 lines

Test #153:

score: 10
Accepted
time: 26ms
memory: 4084kb

input:

10
1409
5 7 5 7 5 7 5 7 4 4 5 4 5 7 4 5 5 7 5 5 7 4 7 5 7 5 4 7 4 4 5 7 4 5 4 5 4 5 4 5 4 5 7 5 4 7 7 5 7 5 7 5 4 5 7 5 7 5 4 5 4 7 4 7 5 4 5 4 7 5 4 7 5 4 4 7 5 4 5 4 5 4 7 5 4 5 7 5 7 7 5 4 7 4 4 7 5 4 4 7 4 7 5 7 4 7 5 7 4 5 7 4 7 5 4 5 4 7 4 7 5 7 4 7 5 7 5 7 4 7 5 4 5 4 5 4 5 7 4 5 4 5 7 4 5 7 ...

output:

650
35953
5072
9541
12804
3615
2850
2157
6906
13231

result:

ok 10 lines

Test #154:

score: 10
Accepted
time: 27ms
memory: 4012kb

input:

10
3068
5 9 5 9 5 9 5 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 7 5 3 7 3 5 3 3 7 3 7 3 7 3 7 3 7 3 7 7 3 7 3 7 3 7 3 7 3 7 3 7 3 7 3 3 7 3 7 3 7 7 3 7 3 7 3 7 3 7 3 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 5 10 5 10 5 10 5 10 5 10 5 10 5 10 5 5 10 5 10 5 10 5 10 5 10 5 10 5 10 5 10 5 ...

output:

204
2149
1155
1115
991
3692
1579
2168
678
1240

result:

ok 10 lines

Test #155:

score: 10
Accepted
time: 27ms
memory: 3876kb

input:

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

output:

1282
2046
23379
6663
35969
40360
8461
620
3104
24727

result:

ok 10 lines

Test #156:

score: 10
Accepted
time: 27ms
memory: 4064kb

input:

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

output:

4227
1111
981
2894
1608
4548
8530
144
851
759

result:

ok 10 lines

Test #157:

score: 10
Accepted
time: 23ms
memory: 3936kb

input:

10
19664
8 3 8 3 8 3 8 3 8 3 6 3 6 3 6 3 6 3 6 3 6 10 6 10 6 10 10 6 10 6 1 2 10 2 10 1 6 1 1 6 1 6 1 4 4 1 4 1 4 1 4 1 4 1 1 4 2 4 2 4 2 4 2 4 2 4 2 4 3 4 3 4 3 4 4 3 4 3 4 3 4 3 4 4 3 4 3 8 3 8 3 8 3 3 8 8 3 8 3 8 3 8 3 8 3 8 8 3 8 3 8 3 8 3 8 3 8 3 8 8 3 8 3 8 8 3 10 3 10 10 3 10 3 10 3 10 3 10 3...

output:

7234
1736
6467
9165
5296
3407
1844
9426
2596
7120

result:

ok 10 lines

Test #158:

score: 10
Accepted
time: 28ms
memory: 3856kb

input:

40
4659
1 5 5 5 5 9 7 10 9 6 9 9 1 8 6 3 7 5 1 3 3 5 6 4 1 3 8 9 7 3 4 3 3 4 5 6 1 2 4 6 6 10 8 10 6 2 1 8 8 3 10 9 9 8 2 1 7 10 2 5 7 5 4 9 6 3 1 1 9 3 2 3 9 1 6 6 10 1 4 2 8 5 3 5 8 2 9 1 8 7 9 1 7 5 2 4 1 7 9 4 7 4 8 4 2 10 1 4 6 9 7 3 4 1 5 1 5 5 6 2 4 5 7 5 9 5 6 3 8 6 4 2 6 8 7 1 7 5 1 1 10 5 ...

output:

3618
1638
4366
1145
5820
3172
3021
558
4339
396
2287
10199
3959
38
7014
4576
2299
19022
1055
7055
7479
1830
1052
163
5597
722
8599
4688
1579
2200
917
5032
11201
6255
11268
1614
3637
1408
3632
1630

result:

ok 40 lines

Test #159:

score: 10
Accepted
time: 25ms
memory: 3776kb

input:

40
2659
3 4 2 4 3 2 3 4 3 2 4 3 2 3 4 4 4 3 2 4 2 3 2 4 3 2 3 2 3 2 4 2 3 4 3 4 2 4 2 3 2 3 4 2 4 2 4 3 2 3 2 4 2 4 3 2 4 4 2 4 3 2 3 2 3 4 3 2 3 4 3 2 3 2 4 3 4 3 2 3 4 2 4 3 2 4 3 4 3 2 4 3 4 2 3 4 3 4 4 3 4 3 2 4 2 3 2 3 4 2 3 4 2 3 4 2 3 4 2 3 2 3 2 4 3 4 3 4 2 2 2 4 2 3 2 4 4 2 4 2 4 2 3 2 4 3 ...

output:

1299
3684
2696
1494
153
400
2888
1651
4821
1622
3710
2502
377
2776
4960
457
1825
789
3808
1993
799
454
209
2305
1958
3720
8738
4637
2076
1025
2831
2262
5457
2709
3114
2917
1749
1823
1335
158

result:

ok 40 lines

Test #160:

score: 10
Accepted
time: 26ms
memory: 3728kb

input:

40
5834
8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 8 1 6 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 8 1 8 1 8 1 8 1 8 1 1 8 7 8 7 8 7 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 8 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 ...

output:

434
106
610
887
283
258
55
456
285
983
110
427
119
241
496
93
1178
702
31
102
24
168
222
305
556
779
423
469
24
10
339
302
266
230
114
850
1263
15
179
282

result:

ok 40 lines

Test #161:

score: 10
Accepted
time: 24ms
memory: 3908kb

input:

40
18191
8 3 8 2 8 3 8 2 8 3 8 4 3 4 7 4 3 4 7 4 3 4 7 4 3 4 7 4 3 4 6 3 6 5 6 3 6 2 3 2 4 2 3 2 4 2 3 2 4 2 3 2 4 2 3 2 4 2 3 2 4 2 3 2 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 1 3 1 9 1 3 1 9 1 3 1 2 3 2 7 2 3 2 7 2 3 2 7 2 3 2 7 2 3 2 4 3 4 10 4 3 4 10 4 3 4 10 4 3 4 ...

output:

13161
538
5394
20556
822
3427
5646
4931
6727
794
3928
370
5593
12003
2195
1924
62
440
245
9001
84
2626
2679
147
2330
6373
482
1514
1161
877
2247
10013
2381
1737
1489
4311
251
1927
610
1601

result:

ok 40 lines

Test #162:

score: 10
Accepted
time: 23ms
memory: 3832kb

input:

40
3170
6 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 7 1 4 1 4 1 4 3 4 3 4 3 4 3 4 3 4 3 4 3 3 4 3 4 3 4 3 4 3 4 4 3 4 3 4 3 4 3 4 3 4 4 3 4 3 4 3 10 10 3 10 3 6 6 3 6 3 6 3 6 7 6 7 6 7 6 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 9 2 9 2...

output:

450
402
1042
824
242
747
659
874
174
890
834
502
38
916
538
754
96
823
161
116
748
712
707
2174
1107
1914
600
504
988
285
887
945
868
18
493
242
641
100
145
283

result:

ok 40 lines

Test #163:

score: 10
Accepted
time: 27ms
memory: 3824kb

input:

40
2690
1 9 9 8 10 9 8 9 8 9 10 8 1 9 1 9 1 9 1 10 9 1 9 10 1 10 9 10 9 10 9 10 1 9 10 9 1 9 10 9 1 9 10 9 6 1 6 9 1 9 6 9 1 6 1 6 1 6 1 6 9 1 6 9 1 6 1 9 1 6 1 9 1 6 9 1 6 9 6 1 6 1 1 6 9 6 9 6 9 6 1 6 9 6 1 6 9 6 9 1 9 6 1 6 7 4 3 4 3 7 3 4 4 7 3 7 4 6 10 6 10 6 10 6 10 6 10 6 6 10 6 10 6 10 6 10 ...

output:

923
1464
95
322
671
239
3698
18558
762
9990
2549
423
916
1475
315
373
12
885
73
720
3876
5412
520
1052
288
2425
2074
2425
144
5855
672
3722
2242
1376
784
3824
494
1019
244
4872

result:

ok 40 lines

Test #164:

score: 10
Accepted
time: 28ms
memory: 3820kb

input:

400
791
10 10 8 9 10 10 7 1 2 8 1 7 3 6 3 6 6 5 2 6 8 1 1 3 8 7 1 9 2 1 2 6 10 4 1 1 10 5 10 4 7 9 7 8 10 10 10 2 4 3 8 1 10 3 4 7 10 6 6 5 4 4 1 1 2 6 7 9 5 1 5 3 3 1 9 6 4 1 3 1 1 8 4 6 9 8 5 9 5 6 9 3 5 8 7 1 5 6 3 8 3 5 5 10 5 4 8 10 8 7 6 10 6 1 6 1 10 7 10 4 1 8 1 10 2 8 9 6 10 5 4 5 4 9 4 1 4...

output:

643
289
134
1604
167
111
466
676
2108
795
146
313
232
7
191
192
473
228
2
74
99
1514
489
6
161
654
631
20
539
380
89
201
370
24
469
267
1287
401
834
473
558
495
463
330
193
29
114
248
669
358
637
1113
15
2852
1159
179
90
168
74
761
120
312
810
15
1568
63
417
73
688
232
280
75
29
1917
496
33
113
163
...

result:

ok 400 lines

Test #165:

score: 10
Accepted
time: 21ms
memory: 3836kb

input:

400
523
1 3 6 1 6 3 1 1 6 3 6 3 1 3 1 3 8 3 1 8 1 3 8 1 3 8 1 3 8 3 8 4 8 3 6 8 6 6 3 8 6 8 3 6 8 8 6 8 3 2 6 2 6 6 3 6 3 2 3 2 3 6 2 6 2 6 3 2 3 2 6 4 3 4 6 4 4 3 4 6 4 3 6 6 3 6 4 3 6 4 3 4 3 6 4 3 4 6 3 4 6 3 4 3 3 6 8 3 8 4 3 4 3 4 10 3 4 3 10 10 4 4 10 4 10 6 10 3 6 3 10 6 3 10 3 10 3 10 6 10 6...

output:

255
9
390
100
25
233
183
264
43
523
430
90
61
56
176
16
727
117
312
81
142
14
19
173
60
172
6
430
169
623
44
107
222
1
238
694
73
82
246
586
42
436
544
11
155
121
140
706
94
122
421
8
245
161
441
169
167
461
200
416
728
192
18
95
16
158
450
477
78
327
37
782
465
252
394
1034
55
227
343
128
555
901
4...

result:

ok 400 lines

Test #166:

score: 10
Accepted
time: 23ms
memory: 3816kb

input:

400
5
8 1 8 1 8
374
5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 1 1 5 1 5 1 1 5 5 1 5 5 5 1 5 1 5 1 1 5 5 1 5 1 1 5 1 5 5 1 1 5 1 5 1 5 1 5 1 5 5 1 5 1 5 1 5 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 5 1 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 1 1 5 1 5 1 5 1 5 1 5 1 5 1 ...

output:

2
22
80
11
4
24
84
65
80
70
26
143
80
149
74
79
29
4
2
23
22
76
57
19
84
19
12
87
31
8
62
2
15
101
25
99
18
9
16
20
31
9
10
12
2
48
19
36
68
8
53
12
4
66
57
30
41
4
22
27
10
40
113
59
9
19
31
2
19
93
13
6
11
28
54
67
10
105
6
7
28
28
4
91
142
12
49
11
24
2
4
2
32
2
4
21
2
51
6
7
7
37
53
4
36
24
10
8...

result:

ok 400 lines

Test #167:

score: 10
Accepted
time: 26ms
memory: 3792kb

input:

400
709
1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 5 4 5 8 5 4 5 8 5 4 5 8 5 4 5 8 5 4 5 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 6 4 6 1 6 ...

output:

516
572
72
375
376
83
167
383
97
622
11
148
1178
957
538
81
9
49
386
677
364
735
225
320
807
233
34
216
1991
135
702
17
7
76
12
531
656
1024
662
474
98
674
62
100
296
618
123
1438
307
622
214
529
135
684
101
1100
84
378
42
275
61
1417
138
716
1166
388
72
45
479
604
335
2
965
142
89
216
72
480
821
63...

result:

ok 400 lines

Test #168:

score: 10
Accepted
time: 25ms
memory: 3724kb

input:

400
699
8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 4 2 4 2 4 2 4 2 9 2 9 10 9 10 9 10 5 10 5 10 5 10 5 10 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 6 8 6 9 6 9 6 9 6 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 3 4 3 4 3 3 4 9 4 9 4 9 4 8 4 8 4...

output:

90
225
83
19
24
69
33
159
62
41
43
23
59
52
8
16
17
62
35
231
88
14
42
54
40
86
25
93
158
24
21
34
33
57
20
42
241
206
60
17
87
3
205
28
33
113
70
25
13
58
4
31
165
52
56
7
20
34
27
26
94
41
32
52
22
69
33
11
122
21
7
20
4
124
6
85
39
47
38
1
61
66
34
122
219
34
47
9
48
60
29
24
68
45
49
30
32
11
63...

result:

ok 400 lines

Test #169:

score: 10
Accepted
time: 25ms
memory: 3784kb

input:

400
801
10 3 10 3 10 3 10 10 3 3 10 3 10 3 10 3 10 3 10 7 6 7 6 7 6 6 7 6 7 6 7 6 7 7 4 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 6 7 6 7 6 7 6 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 1 7 4 6 1 7 1 6 7 6 1 7 6 1 6 7 7 6 6 6 7 6 7 6 7 6 7 6 4 6 4 4 6 4 6 4 6 4 4 6 6 4 6 4 3 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 ...

output:

118
413
269
126
612
16
243
73
57
221
165
223
201
16
35
77
758
46
198
52
89
188
8
9
51
89
14
30
152
103
4
6
230
263
47
251
241
159
60
22
47
18
25
203
83
73
116
16
306
357
71
338
149
38
49
33
598
95
36
376
290
990
307
56
29
58
174
69
56
251
62
94
12
209
103
129
199
220
7
497
77
220
152
44
24
21
33
379...

result:

ok 400 lines

Test #170:

score: 10
Accepted
time: 26ms
memory: 3800kb

input:

5000
5
6 4 9 6 1
86
6 7 7 6 6 8 3 6 5 7 4 2 10 3 4 5 4 10 5 7 4 4 6 5 1 3 8 8 7 8 7 8 7 1 3 4 5 6 4 9 3 1 2 1 5 9 2 3 9 6 8 5 5 10 1 8 1 4 5 9 9 3 5 8 5 8 7 10 8 4 8 9 9 5 4 9 6 4 6 6 3 4 5 5 7 4
136
4 7 1 1 3 2 1 10 6 8 4 8 1 2 1 8 7 8 1 3 1 8 6 1 6 8 7 9 8 3 2 7 10 7 9 6 7 3 10 7 9 10 9 2 9 4 9 4 ...

output:

5
64
117
18
34
56
16
44
28
31
38
16
49
31
71
16
17
57
87
9
5
6
148
26
9
17
24
70
6
1
6
88
29
3
82
76
30
91
24
44
29
14
22
14
13
11
5
15
14
23
2
31
17
12
29
12
111
18
19
19
18
12
32
25
7
19
12
68
32
14
10
10
28
9
54
23
14
22
25
10
11
15
36
25
41
6
25
50
25
8
23
39
34
30
20
9
9
39
46
22
3
8
15
8
7
17
...

result:

ok 5000 lines

Test #171:

score: 10
Accepted
time: 21ms
memory: 3776kb

input:

5000
77
4 3 4 2 3 4 2 3 2 10 10 3 2 3 3 10 2 10 2 10 2 10 3 10 2 3 2 10 3 2 10 2 3 10 7 2 10 2 7 2 10 2 7 2 10 2 7 10 2 10 7 1 10 1 10 1 1 7 1 7 10 1 10 1 10 7 1 7 1 7 8 1 2 1 5 2 1
6
2 3 5 5 2 3
15
1 4 4 1 4 9 4 9 4 9 4 9 9 4 9
29
1 8 3 3 8 8 9 3 9 8 3 8 9 9 3 9 3 9 8 3 8 9 3 9 3 9 8 8 9
89
10 7 2 ...

output:

46
5
4
13
60
73
1
24
16
18
29
28
22
7
60
14
8
6
68
58
8
25
42
42
7
63
65
3
5
27
24
77
40
59
13
33
40
1
3
30
8
28
41
30
30
16
49
7
50
15
18
31
11
18
6
8
13
8
3
21
22
19
13
5
11
8
11
6
6
33
37
20
1
10
5
19
36
52
13
14
40
27
11
26
6
73
25
5
1
15
13
2
13
23
14
25
11
2
5
11
9
2
41
10
41
3
35
41
6
10
9
18...

result:

ok 5000 lines

Test #172:

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

input:

5000
9
5 8 5 8 5 8 5 8 5
9
7 2 7 2 7 2 7 2 7
81
6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7
76
3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3...

output:

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

result:

ok 5000 lines

Test #173:

score: 10
Accepted
time: 26ms
memory: 3704kb

input:

5000
109
9 6 9 1 9 6 9 2 6 2 10 2 6 2 5 6 5 9 5 6 5 9 5 6 5 3 10 3 2 3 10 3 2 3 10 3 2 3 10 3 2 3 10 3 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 3 10 3 4 3 10 3 4 3 10 3 1 10 1 6 1 10 1 6 1 10 1 6 1 10 1
20
9 2 5 7 10 10 2 3 2 2 8 4 9 7 2 6 6 5 1 2
35
10...

output:

78
16
25
6
3
19
48
15
7
13
28
7
5
36
48
8
10
85
49
44
2
3
16
21
25
65
26
91
23
2
81
34
17
28
19
16
15
4
15
79
6
18
5
27
44
10
30
35
54
13
26
35
143
19
27
27
2
22
11
31
32
63
4
14
55
59
28
16
31
7
43
46
34
2
45
41
10
53
18
64
11
50
49
14
52
28
50
2
36
8
42
12
39
8
25
1
176
6
9
47
48
17
5
21
35
5
23
1...

result:

ok 5000 lines

Test #174:

score: 10
Accepted
time: 19ms
memory: 3848kb

input:

5000
8
8 5 8 2 3 2 3 2
11
4 9 4 9 4 9 4 9 4 6 4
68
6 1 6 1 6 1 6 1 6 1 6 2 6 2 6 2 6 6 6 2 6 2 6 2 6 5 6 5 5 6 5 6 5 6 5 6 5 6 6 5 6 5 6 5 6 2 6 2 6 2 6 6 2 6 6 2 6 2 6 2 6 2 6 2 6 2 1 2
42
9 10 9 10 9 10 9 10 9 5 9 5 9 5 9 5 5 5 5 9 5 9 5 9 5 9 5 9 5 9 5 4 5 4 5 4 5 5 4 5 4 4
8
6 10 6 10 1 10 1 10
...

output:

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

result:

ok 5000 lines

Test #175:

score: 10
Accepted
time: 21ms
memory: 3828kb

input:

5000
1
6
68
5 9 9 5 9 5 9 5 5 7 1 7 1 7 6 1 6 7 6 7 6 2 7 6 2 7 10 2 7 2 4 2 4 2 5 4 5 1 9 1 9 1 9 1 9 1 9 1 7 2 2 1 2 7 2 1 1 7 9 7 5 6 7 5 6 10 3 10
3
7 1 7
1
9
18
3 2 7 1 4 7 9 7 4 7 4 7 4 7 4 7 4 7
18
2 10 2 4 9 10 9 10 9 1 6 1 6 1 5 6 5 5
96
10 6 10 1 10 4 2 4 2 4 2 4 2 4 2 3 1 7 3 6 10 6 10 6 ...

output:

1
37
2
1
9
9
39
27
31
9
9
42
11
13
14
22
10
22
4
39
20
26
26
33
38
15
3
7
12
10
30
18
24
13
1
13
2
1
12
16
7
2
6
13
11
40
14
7
15
17
6
4
2
18
82
7
5
8
29
14
7
15
1
76
2
1
8
52
9
62
26
13
51
10
14
32
35
16
11
47
18
6
19
13
6
39
19
5
22
12
3
9
9
11
60
9
17
10
6
7
31
33
7
60
4
42
7
8
6
8
15
6
9
13
4
10...

result:

ok 5000 lines

Test #176:

score: 10
Accepted
time: 21ms
memory: 3808kb

input:

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

output:

2
9
2
2
3
3
1
2
4
6
6
1
3
2
1
7
6
1
7
4
4
2
6
9
1
4
1
3
4
2
4
1
5
6
1
1
3
10
2
23
3
3
4
10
1
9
1
4
4
4
4
4
1
13
2
1
11
1
3
2
4
5
1
3
7
2
5
7
3
1
3
1
6
1
7
1
2
2
2
7
4
8
4
2
3
1
4
12
3
3
1
1
1
4
8
1
20
15
3
1
20
1
2
4
2
4
3
1
2
10
10
5
10
1
1
5
3
8
5
8
1
5
1
8
5
5
11
3
2
4
1
2
8
9
2
3
4
4
3
1
4
4
5
3...

result:

ok 40000 lines

Test #177:

score: 10
Accepted
time: 23ms
memory: 3812kb

input:

40000
1
6
6
7 9 7 5 9 5
11
10 3 10 7 10 7 7 8 5 8 10
2
7 5
2
9 10
3
8 2 1
10
10 6 10 6 10 3 6 8 6 9
1
2
2
7 9
5
5 8 2 5 2
11
10 1 10 9 1 9 4 5 9 4 5
3
7 2 7
12
6 10 6 10 8 6 8 10 6 8 10 6
26
1 10 1 9 9 10 1 9 10 2 1 9 1 9 2 1 2 2 2 1 2 9 2 9 2 2
4
8 2 3 9
3
7 9 1
2
5 8
3
5 7 5
17
8 10 8 10 6 8 10 6 ...

output:

1
4
7
2
2
3
6
1
2
4
9
2
8
14
4
3
2
2
11
2
1
1
4
1
2
1
3
8
1
2
1
3
3
3
4
6
3
1
17
3
1
2
3
2
3
2
2
1
4
2
2
1
3
1
2
3
7
3
1
3
5
8
3
2
9
1
4
2
3
2
2
4
5
2
1
13
2
4
3
2
1
4
3
4
2
3
1
2
2
2
1
6
1
1
1
9
1
7
9
10
9
4
5
3
2
2
6
5
5
1
3
1
2
3
1
1
3
1
7
1
1
6
5
1
1
7
2
1
7
6
2
2
10
1
5
5
1
3
2
1
2
1
1
2
2
10
1...

result:

ok 40000 lines

Test #178:

score: 10
Accepted
time: 18ms
memory: 3812kb

input:

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

output:

2
2
1
2
2
1
2
1
1
2
1
2
2
2
2
2
4
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
3
3
2
2
1
2
2
1
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
6
2
1
2
2
1
1
2
1
2
1
2
2
2
2
2
2
1
2
2
2
1
2
2
2
1
2
1
2
1
2
2
2
2
1
2
2
1
2
2
1
2
2
1
2
2
2
1
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
1
2
2
2
2
1
1
2
2
2
...

result:

ok 40000 lines

Test #179:

score: 10
Accepted
time: 23ms
memory: 3848kb

input:

40000
18
5 4 3 8 1 5 8 8 5 2 8 4 5 7 1 3 5 3
2
4 10
4
5 7 5 10
5
1 5 6 3 2
1
4
7
8 1 1 3 4 3 4
2
4 3
7
7 1 9 2 4 8 3
2
5 8
18
2 10 9 8 2 5 4 8 10 5 3 1 8 4 10 6 5 2
3
8 6 9
5
7 5 8 2 9
2
9 3
1
3
4
2 7 1 6
16
5 2 4 1 7 2 6 8 9 3 10 8 10 3 2 6
1
4
11
7 4 9 9 7 2 4 5 9 3 4
2
3 8
6
5 10 6 5 4 10
7
1 8 2...

output:

14
2
3
5
1
4
2
7
2
18
3
5
2
1
4
15
1
10
2
6
6
1
2
3
4
1
1
8
1
1
4
7
2
3
2
14
3
1
1
5
15
3
1
6
2
2
1
5
3
4
2
3
5
1
1
11
5
5
7
2
6
1
1
8
2
10
6
2
1
6
4
2
4
5
2
5
1
3
1
3
7
2
4
10
14
2
2
3
7
5
9
2
5
5
2
2
3
1
5
11
1
2
4
2
7
6
1
3
2
1
4
3
4
2
7
3
5
6
7
3
5
3
1
4
3
1
3
9
1
1
2
2
2
1
3
4
2
1
4
18
1
3
5
1
...

result:

ok 40000 lines

Test #180:

score: 10
Accepted
time: 18ms
memory: 3720kb

input:

40000
6
6 3 6 3 6 3
1
1
2
1 5
3
1 6 1
2
3 4
2
2 3
2
4 5
2
1 8
1
6
5
1 8 1 8 1
13
2 10 2 10 2 10 10 2 10 2 10 2 10
2
7 3
6
7 6 7 1 7 1
3
8 7 8
3
10 9 10
1
9
8
9 4 9 4 9 4 9 9
4
10 5 10 5
5
6 4 6 4 6
15
4 10 4 10 4 4 10 4 10 4 4 10 4 10 4
10
7 1 7 1 7 1 7 1 7 7
6
3 8 3 8 3 3
10
4 4 3 4 10 4 10 4 10 4
...

output:

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

result:

ok 40000 lines

Test #181:

score: 10
Accepted
time: 27ms
memory: 3704kb

input:

40000
1
9
1
5
1
9
12
6 9 10 4 5 7 8 1 5 3 5 5
1
7
1
3
2
6 10
3
2 3 6
10
8 10 1 10 10 4 3 10 6 10
1
3
8
10 6 4 3 6 6 10 7
22
1 1 5 9 9 1 9 1 5 5 1 5 9 5 1 9 5 1 7 6 10 1
4
8 1 8 7
4
5 6 5 6
7
7 1 7 1 8 10 7
1
8
2
5 9
2
8 3
9
3 5 3 5 5 3 5 3 5
5
10 6 6 5 3
1
8
2
6 4
12
10 4 9 7 8 8 7 8 7 8 7 8
9
9 6 3...

output:

1
1
1
10
1
1
2
3
7
1
7
15
3
2
5
1
2
2
2
4
1
2
5
8
7
2
4
2
2
2
1
1
5
1
3
2
3
1
2
3
1
9
4
5
3
2
1
3
8
9
1
3
2
10
2
4
2
4
2
1
1
4
3
5
18
2
4
1
2
5
3
2
4
1
7
1
5
6
6
3
1
3
1
1
10
6
2
1
2
2
2
18
3
1
2
1
6
12
1
3
14
2
8
6
3
2
3
1
2
2
2
3
3
4
2
2
4
3
5
3
4
5
1
1
8
3
1
11
1
2
2
2
9
2
3
7
2
4
4
4
8
5
3
9
3
1...

result:

ok 40000 lines

Test #182:

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

input:

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

output:

1754
2724
3230

result:

ok 3 lines

Test #183:

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

input:

3
174
7 7 7 7 3 6 7 6 3 6 6 3 6 3 7 3 7 3 7 6 3 6 7 6 7 6 6 7 7 6 3 6 7 3 6 7 3 7 3 3 6 7 6 7 3 7 6 3 7 7 3 7 6 7 6 6 3 3 6 7 3 7 6 7 6 3 7 3 6 7 3 3 6 7 3 7 6 3 7 7 3 6 3 6 7 6 7 6 7 7 3 6 6 3 7 3 6 3 3 7 6 3 7 3 6 7 6 7 6 7 3 6 3 5 3 5 6 5 6 3 6 3 6 5 5 5 6 3 5 3 3 6 5 3 6 3 6 3 5 6 6 3 6 3 6 3 5 ...

output:

83
62
4581

result:

ok 3 lines

Test #184:

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

input:

3
2001
7 5 7 5 7 5 7 7 5 7 5 7 5 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 7 5 5 7 5 7 5 7 5 5 7 5 7 7 5 7 7 5 7 5 7 5 5 7 5 7 5 7 7 5 7 5 7 5 7 5 7 5 7 5 5 5 7 5 7 5 7 5 5 7 5 7 5 7 5 7 7 5 7 5 5 7 7 5 7 5 7 5 7 7 5 7 5 7 7 5 7 7 5 7 5 7 7 7 5 7 5 7 5 5 7 5 5 7 5 7 5 5 7 5 7 7 5 7 5 7 5 7 7 7 5 7...

output:

138
291
136

result:

ok 3 lines

Test #185:

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

input:

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

output:

445
1161
5526

result:

ok 3 lines

Test #186:

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

input:

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

output:

294
521
359

result:

ok 3 lines

Test #187:

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

input:

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

output:

625
1436
596

result:

ok 3 lines

Test #188:

score: 10
Accepted
time: 35ms
memory: 4376kb

input:

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

output:

13568
148675
2837

result:

ok 3 lines

Test #189:

score: 10
Accepted
time: 27ms
memory: 4192kb

input:

3
38910
1 6 1 4 1 6 1 4 1 6 1 4 1 6 6 4 6 1 6 4 6 1 4 6 1 6 4 1 6 6 1 4 1 4 6 4 1 4 6 1 4 6 1 4 1 4 6 1 4 6 4 1 6 6 1 4 1 6 4 6 1 6 1 4 1 4 6 6 4 6 1 6 1 4 1 4 1 6 4 1 6 1 4 4 1 4 1 4 6 1 6 1 4 6 1 6 1 4 1 4 1 6 1 4 1 4 6 1 4 1 6 1 6 1 6 4 4 1 6 4 1 4 6 1 1 4 6 4 6 4 1 6 6 1 4 6 6 4 6 4 1 4 1 6 1 1 ...

output:

16989
42639
32426

result:

ok 3 lines

Test #190:

score: 10
Accepted
time: 21ms
memory: 4216kb

input:

3
47211
7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 3 7 3 7 3 7 5 7 5 7 5 7 5 7 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 4 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 5 3 5 3 5 3 ...

output:

3525
1703
8644

result:

ok 3 lines

Test #191:

score: 10
Accepted
time: 22ms
memory: 4172kb

input:

3
92161
4 7 4 3 4 7 4 3 4 7 4 1 7 1 2 1 7 1 2 1 7 1 2 1 7 1 2 1 7 1 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 ...

output:

68687
56160
24330

result:

ok 3 lines

Test #192:

score: 10
Accepted
time: 17ms
memory: 4240kb

input:

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

output:

9129
1840
11031

result:

ok 3 lines

Test #193:

score: 10
Accepted
time: 22ms
memory: 4232kb

input:

3
7124
3 6 5 6 5 2 5 5 2 5 2 5 2 5 5 2 5 2 5 2 5 4 2 2 6 2 3 2 3 2 3 2 3 2 3 3 2 2 2 3 2 3 2 2 3 2 6 2 2 6 6 2 6 3 6 6 3 6 3 6 3 6 3 6 2 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 6 2 6 2 6 2 6 2 6 2 3 2 3 2 4 2 4 2 4 2 4 2 4 2 4 5 4 5 4 5 4 5 4 5 4 3 4 4 3 4 4 3 4 3 6 6 3 3 6 3 3 6 3 6 3 3 6 3 4 3 4 3 4 3 7 7...

output:

3675
19486
16811

result:

ok 3 lines

Subtask #6:

score: 0
Skipped

Dependency #3:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%