QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#43105#2278. TortoiseZhangYiDe100 ✓489ms49688kbC++233.8kb2022-08-07 19:17:092022-08-07 19:17:10

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 3ms
memory: 31840kb

input:

16
0 0 1 0 0 0 1 0 1 -1 1 1 1 0 -1 -1

output:

1

result:

ok single line: '1'

Test #2:

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

input:

16
1 1 0 1 0 0 1 0 1 -1 1 1 1 0 -1 -1

output:

3

result:

ok single line: '3'

Test #3:

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

input:

16
1 0 1 0 1 0 1 0 1 -1 1 1 1 0 -1 -1

output:

3

result:

ok single line: '3'

Test #4:

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

input:

16
1 1 0 1 1 0 1 0 1 -1 1 1 1 0 -1 -1

output:

4

result:

ok single line: '4'

Test #5:

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

input:

16
-1 0 -1 0 0 1 1 0 1 -1 1 1 1 0 -1 -1

output:

1

result:

ok single line: '1'

Test #6:

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

input:

16
0 1 1 0 0 1 1 0 1 -1 1 1 1 0 -1 -1

output:

3

result:

ok single line: '3'

Test #7:

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

input:

16
0 0 1 1 0 1 1 0 1 -1 1 1 1 0 -1 -1

output:

3

result:

ok single line: '3'

Test #8:

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

input:

16
0 0 0 0 1 1 1 0 1 -1 1 1 1 0 -1 -1

output:

2

result:

ok single line: '2'

Test #9:

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

input:

16
-1 0 0 1 1 1 1 0 1 -1 1 1 1 0 -1 -1

output:

3

result:

ok single line: '3'

Test #10:

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

input:

16
1 0 0 1 0 0 1 0 1 -1 1 1 1 0 0 -1

output:

2

result:

ok single line: '2'

Test #11:

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

input:

16
1 1 0 1 0 0 1 0 1 -1 1 1 1 0 0 -1

output:

3

result:

ok single line: '3'

Test #12:

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

input:

16
0 0 0 1 1 0 1 0 1 -1 1 1 1 0 0 -1

output:

2

result:

ok single line: '2'

Test #13:

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

input:

16
-1 0 -1 0 0 1 1 0 1 -1 1 1 1 0 0 -1

output:

1

result:

ok single line: '1'

Test #14:

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

input:

16
0 0 -1 0 0 1 1 0 1 -1 1 1 1 0 0 -1

output:

1

result:

ok single line: '1'

Test #15:

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

input:

16
1 0 1 0 0 1 1 0 1 -1 1 1 1 0 0 -1

output:

3

result:

ok single line: '3'

Test #16:

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

input:

16
-1 1 1 0 -1 0 -1 0 0 1 1 0 0 1 1 -1

output:

0

result:

ok single line: '0'

Test #17:

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

input:

16
0 0 -1 -1 -1 1 0 1 1 0 1 1 1 1 1 -1

output:

3

result:

ok single line: '3'

Test #18:

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

input:

16
0 0 0 0 1 0 0 0 0 0 0 1 0 1 1 -1

output:

0

result:

ok single line: '0'

Test #19:

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

input:

16
0 1 0 1 0 1 0 0 0 1 0 0 1 -1 0 -1

output:

2

result:

ok single line: '2'

Test #20:

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

input:

16
0 1 -1 1 1 0 1 0 1 0 0 1 1 -1 0 -1

output:

1

result:

ok single line: '1'

Test #21:

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

input:

16
0 0 1 -1 -1 0 1 1 -1 0 -1 0 -1 0 0 -1

output:

0

result:

ok single line: '0'

Test #22:

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

input:

16
-1 -1 -1 -1 -1 0 0 -1 1 1 0 1 0 -1 0 -1

output:

0

result:

ok single line: '0'

Test #23:

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

input:

16
0 -1 0 1 0 1 -1 1 -1 0 1 1 1 1 0 -1

output:

1

result:

ok single line: '1'

Test #24:

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

input:

16
1 -1 0 0 0 0 1 1 -1 0 0 1 0 -1 0 -1

output:

0

result:

ok single line: '0'

Test #25:

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

input:

16
1 0 0 0 1 0 1 1 0 0 -1 1 -1 -1 1 -1

output:

2

result:

ok single line: '2'

Test #26:

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

input:

16
1 1 0 0 0 1 0 0 0 0 1 0 0 -1 0 -1

output:

2

result:

ok single line: '2'

Subtask #2:

score: 10
Accepted

Test #27:

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

input:

249
-1 1 0 -1 1 1 0 0 1 0 1 0 0 0 1 0 0 1 -1 -1 0 0 0 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0 1 -1 1 0 0 -1 1 0 0 0 -1 0 0 1 0 -1 0 1 1 0 1 1 -1 0 0 1 -1 -1 0 1 1 1 0 0 0 1 0 0 0 1 1 -1 0 1 0 1 0 0 -1 0 0 0 0 -1 -1 0 1 0 -1 -1 1 0 0 1 0 1 0 1 1 -1 1 0 1 1 -1 0 1 0 1 -1 0 0 1 0 0 0 0 1 1 0 0 1 1 ...

output:

15

result:

ok single line: '15'

Test #28:

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

input:

292
0 1 1 0 0 0 1 1 -1 1 0 1 1 1 0 1 1 1 1 0 0 1 1 0 1 0 0 0 0 0 1 1 0 0 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0 1 1 -1 0 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 -1 1 0 1 1 1 1 1 0 1 1 1 -1 0 0 1 1 1 0 1 0 1 0 1 1 0 1 0 -1 1 1 1 0 1 0 0 0 1 1 1 0 1 0 1 1 -1 1 0 1 0 0 0 0 0 1 1 1 1 1 1 0 1 1 1 -1 1 1 1 0 -1 0 0 0 ...

output:

88

result:

ok single line: '88'

Test #29:

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

input:

278
0 1 -1 1 0 1 0 1 0 0 1 1 0 1 0 1 -1 -1 1 1 0 1 0 0 1 1 0 -1 0 0 0 1 -1 0 1 0 0 0 1 -1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 -1 -1 -1 1 1 1 0 0 0 -1 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0 0 0 1 0 0 1 0 -1 0 1 1 0 -1 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 1 0 0 -1 1 1 0 0 0 1 0 1 1...

output:

38

result:

ok single line: '38'

Test #30:

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

input:

255
0 0 -1 -1 0 0 -1 1 1 0 0 0 -1 1 -1 0 0 0 0 1 0 1 1 -1 1 0 1 1 1 1 0 1 0 1 1 1 -1 1 1 0 0 1 0 0 1 1 -1 0 0 0 -1 -1 0 1 1 -1 0 1 -1 1 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 0 1 0 1 -1 1 1 0 1 1 1 0 -1 1 0 0 -1 1 0 0 -1 0 0 1 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0 -1 -1 0 0 1 0 0 -1 0 1 1 0 0 -1 0 0 1 -1 1...

output:

17

result:

ok single line: '17'

Test #31:

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

input:

294
1 1 -1 0 -1 -1 0 1 0 -1 0 1 1 0 0 0 1 -1 -1 1 -1 0 0 -1 -1 0 1 0 -1 1 0 0 -1 0 0 -1 0 -1 1 -1 0 0 1 0 1 1 0 1 0 -1 1 0 1 0 -1 1 0 1 0 1 0 0 -1 0 0 1 1 0 0 0 0 0 1 0 1 0 -1 1 0 1 0 1 1 1 1 0 0 1 0 0 -1 1 0 0 1 -1 -1 1 1 0 0 -1 0 0 0 0 1 0 0 0 0 1 0 -1 0 0 0 0 0 1 0 1 1 1 1 0 0 -1 1 1 0 0 1 -1 1 1...

output:

4

result:

ok single line: '4'

Test #32:

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

input:

215
0 1 1 0 1 0 0 -1 1 0 0 0 -1 -1 1 0 0 1 -1 1 1 1 1 1 0 0 1 1 1 0 -1 0 1 0 0 0 0 1 0 1 0 0 -1 0 0 1 0 -1 1 1 1 -1 1 -1 0 0 1 0 0 -1 1 -1 0 1 1 0 -1 0 -1 -1 0 1 -1 -1 1 1 0 1 0 1 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 1 -1 1 1 1 0 -1 1 1 0 0 0 0 0 -1 1 1 -1 1 0 -1 1 1 1 0 1 0 1 -1 0 1 0 -1 -1 0 0 -1 0 1 0 1...

output:

18

result:

ok single line: '18'

Test #33:

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

input:

274
0 0 0 0 1 1 0 -1 1 0 -1 0 0 0 0 0 0 -1 1 1 0 0 0 -1 1 0 0 0 0 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 0 0 1 1 0 0 1 -1 -1 0 1 0 1 0 0 1 1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 1 1 0 1 1 0 0 0 1 0 1 0 0 0 -1 0 1 -1 -1 0 0 1 0 1 1 1 -1 0 1 1 -1 0 -1 0 0 0 1 0 0 1 0 1 1 1 0 -1 0 1 1 1 1 -1 1 -1 0...

output:

32

result:

ok single line: '32'

Test #34:

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

input:

255
-1 -1 1 1 0 0 1 1 1 1 0 1 1 0 0 0 1 0 1 0 1 -1 0 0 1 0 -1 1 1 0 1 1 1 1 0 1 0 1 0 1 1 1 1 0 -1 0 1 -1 1 1 0 0 0 1 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 -1 0 0 1 1 1 1 1 1 0 0 1 1 1 -1 0 1 0 1 0 1 1 1 1 0 1 0 1 1 0 0 0 1 1 1 0 1 1 1 0 0 -1 -1 1 0 1 0 1 0 0 -1 1 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 0 1 0 -1 1 1 ...

output:

34

result:

ok single line: '34'

Test #35:

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

input:

300
-1 -1 0 0 0 -1 0 1 1 0 0 1 0 1 0 -1 1 0 -1 1 0 0 0 0 1 1 0 0 -1 0 0 1 0 0 -1 0 0 0 -1 -1 0 -1 1 1 1 -1 1 0 0 1 -1 1 -1 0 1 1 1 -1 1 1 0 -1 0 0 0 0 1 0 1 1 0 0 1 1 1 0 1 0 0 1 -1 0 0 -1 0 -1 0 -1 1 -1 1 0 -1 -1 1 0 0 0 0 1 -1 0 1 0 0 0 0 -1 1 1 1 1 -1 -1 0 0 1 -1 0 1 -1 1 1 1 1 0 1 1 0 -1 0 0 0 -...

output:

3

result:

ok single line: '3'

Test #36:

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

input:

300
0 0 0 1 0 -1 0 0 0 -1 0 -1 0 1 1 1 -1 1 1 0 0 1 0 1 0 1 1 0 0 -1 1 1 0 0 0 0 -1 0 1 0 0 -1 0 1 1 -1 0 0 0 1 1 1 0 -1 0 -1 1 0 0 -1 -1 -1 1 0 -1 1 0 1 -1 0 0 0 -1 0 1 0 0 1 -1 0 1 1 0 -1 0 1 1 0 1 -1 0 1 -1 1 1 1 0 0 0 0 0 0 0 0 1 -1 0 1 1 0 0 0 -1 0 -1 0 0 1 0 1 1 0 0 1 -1 -1 0 0 -1 1 0 0 -1 1 0...

output:

1

result:

ok single line: '1'

Test #37:

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

input:

300
0 1 -1 0 0 1 1 0 -1 0 1 -1 1 0 0 0 0 0 -1 0 1 1 1 1 1 0 1 -1 0 1 0 1 0 -1 -1 1 1 1 1 0 -1 0 0 1 0 1 1 0 -1 0 -1 0 -1 1 0 1 -1 1 1 0 0 1 -1 1 1 1 0 0 0 1 -1 0 -1 0 -1 0 -1 1 1 1 -1 1 0 -1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 -1 0 -1 1 0 -1 -1 0 0 1 -1 1 0 1 0 1 1 0 -1 0 0 -1 0 1 0 -1 1 0 0 0 0 0 0 0 1 -1 ...

output:

1

result:

ok single line: '1'

Test #38:

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

input:

300
1 1 0 1 1 0 1 0 1 0 0 0 1 0 -1 0 0 0 1 0 1 -1 0 -1 0 -1 1 1 -1 0 1 0 -1 -1 -1 1 0 1 1 1 1 1 0 1 1 -1 -1 -1 0 1 0 -1 0 1 -1 0 1 1 0 1 -1 -1 -1 -1 1 -1 0 -1 1 -1 1 0 1 1 -1 0 1 1 0 -1 0 0 1 1 0 1 -1 1 0 -1 0 -1 1 0 -1 0 0 0 0 1 0 -1 -1 1 1 -1 1 0 1 1 0 1 0 -1 0 0 0 0 1 1 -1 -1 1 1 0 0 0 0 0 0 1 0 ...

output:

7

result:

ok single line: '7'

Test #39:

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

input:

300
1 1 0 -1 0 0 1 0 0 0 -1 -1 0 0 -1 0 -1 0 0 0 0 0 -1 -1 1 0 1 0 1 1 0 0 0 1 -1 0 -1 0 0 0 1 0 0 -1 0 0 0 0 0 0 1 1 1 1 1 0 -1 0 1 1 -1 1 1 0 0 1 0 -1 -1 1 0 1 1 0 0 0 1 0 0 -1 -1 -1 1 1 1 0 -1 0 1 1 -1 1 0 1 -1 0 -1 0 0 -1 1 1 0 0 -1 1 0 1 0 1 1 0 1 0 -1 0 0 -1 1 0 0 1 1 0 -1 1 1 -1 1 0 1 0 1 0 0...

output:

8

result:

ok single line: '8'

Test #40:

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

input:

300
1 0 1 1 0 0 -1 1 0 1 1 -1 -1 1 1 0 1 0 1 0 0 0 0 1 0 0 1 -1 -1 1 0 0 0 0 -1 0 0 -1 -1 1 1 1 0 0 0 -1 0 1 0 0 0 1 0 0 0 1 1 -1 1 0 1 1 1 -1 -1 1 0 0 1 -1 1 0 0 0 0 1 0 1 0 0 -1 0 -1 -1 1 0 1 0 0 0 1 1 -1 0 1 1 0 1 -1 1 0 1 -1 1 1 0 0 1 -1 1 -1 -1 0 1 1 -1 -1 0 0 0 0 1 -1 0 0 0 -1 0 -1 1 1 0 0 1 0...

output:

3

result:

ok single line: '3'

Test #41:

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

input:

300
0 -1 0 1 0 1 1 -1 -1 1 0 0 -1 -1 1 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 1 1 0 -1 0 1 1 0 1 0 1 1 1 1 1 0 -1 -1 1 -1 0 -1 0 -1 -1 1 1 0 -1 -1 1 0 1 -1 0 -1 1 -1 -1 0 0 1 1 -1 0 0 0 -1 0 -1 -1 1 1 -1 1 1 1 0 -1 1 0 0 -1 1 0 0 0 1 0 0 1 1 0 1 1 0 -1 -1 0 0 1 0 -1 0 -1 0 -1 1 0 -1 0 1 0 0 0 0 1 1 -1 -1 -1...

output:

2

result:

ok single line: '2'

Subtask #3:

score: 30
Accepted

Test #42:

score: 30
Accepted
time: 6ms
memory: 27864kb

input:

203
0 1 -1 0 0 -1 -1 3 1 0 0 0 0 0 -1 0 0 2 0 0 0 0 0 0 0 -1 -1 0 0 -1 0 -1 2 0 2 0 0 0 0 0 3 0 0 -1 0 0 0 -1 -1 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 -1 3 6 0 -1 0 0 2 -1 0 2 0 0 0 0 0 0 0 -1 -1 0 -1 0 -1 0 0 1 -1 -1 0 2 0 2 -1 0 0 0 6 -1 3 0 0 0 0 0 0 0 2 0 0 -1 -1 -1 1 0 0 -1 -1 0 -1 2 0 1 0 -1 0 0 0 -1 1...

output:

2

result:

ok single line: '2'

Test #43:

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

input:

208
0 0 1 1 1 0 -1 -1 4 0 0 0 0 0 1 0 0 0 -1 -1 0 0 2 0 -1 0 4 0 1 0 0 0 0 0 0 -1 0 0 0 1 0 0 0 3 0 0 0 -1 0 0 0 0 4 0 0 1 -1 0 3 0 0 1 2 0 0 -1 1 -1 3 0 1 -1 1 0 -1 0 0 1 -1 0 0 0 -1 -1 -1 0 0 0 1 2 0 0 0 6 0 0 1 0 -1 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 3 0 0 0 0 0 0 2 0 -1 0 1 0 0 0 -1 0 5 0 0 -1 1 0 0...

output:

22

result:

ok single line: '22'

Test #44:

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

input:

238
0 0 0 0 0 0 2 0 1 2 0 -1 0 4 3 0 0 -1 1 0 -1 0 1 1 0 0 0 0 1 0 0 -1 -1 4 1 2 2 -1 0 -1 -1 0 0 7 -1 6 -1 0 0 1 -1 0 0 0 0 1 0 1 0 0 2 0 0 0 0 0 0 0 -1 0 1 -1 0 0 0 0 0 0 1 0 0 2 2 0 3 -1 0 1 0 1 0 1 0 0 4 0 0 0 -1 0 0 3 3 4 1 0 0 0 0 1 1 4 2 0 -1 0 0 2 -1 0 0 -1 0 0 0 0 0 -1 1 0 1 0 1 1 2 1 0 2 0...

output:

43

result:

ok single line: '43'

Test #45:

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

input:

282
0 0 1 0 2 0 0 1 1 0 0 1 0 2 -1 -1 1 0 0 0 2 2 0 0 0 0 0 0 -1 1 0 -1 0 0 0 0 1 0 1 2 0 1 0 0 -1 -1 2 -1 0 1 0 0 0 1 3 1 0 0 0 -1 -1 0 0 2 1 0 0 0 0 0 1 0 -1 3 0 0 1 0 2 -1 1 0 2 0 0 0 0 -1 -1 1 4 0 0 0 2 0 5 -1 0 0 1 0 0 0 1 0 0 0 1 1 1 0 0 1 0 -1 -1 0 -1 1 0 3 0 0 1 2 0 -1 -1 1 0 0 0 1 0 -1 1 1 ...

output:

19

result:

ok single line: '19'

Test #46:

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

input:

227
0 0 -1 0 -1 0 -1 0 0 0 3 -1 0 0 0 0 2 0 2 0 0 0 0 0 0 0 -1 1 -1 0 1 1 1 -1 0 0 0 -1 0 0 0 0 0 0 0 0 0 2 1 0 0 0 1 1 0 0 -1 0 0 2 0 1 0 0 0 0 0 0 0 -1 -1 -1 0 0 0 -1 0 0 0 0 0 0 -1 -1 -1 -1 -1 0 1 1 -1 0 2 0 0 0 0 -1 0 0 0 0 0 0 3 -1 5 0 0 0 -1 -1 0 0 -1 3 0 -1 -1 0 0 -1 -1 1 0 0 0 0 0 0 0 -1 0 0...

output:

4

result:

ok single line: '4'

Test #47:

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

input:

202
0 0 3 0 0 0 0 1 0 0 1 1 0 0 1 -1 -1 -1 1 0 0 1 2 0 1 1 0 -1 2 2 2 0 0 0 0 0 0 -1 2 0 -1 1 0 0 1 0 -1 3 0 0 0 0 0 -1 1 0 0 0 -1 1 0 0 0 1 0 1 0 2 0 0 0 0 1 0 2 1 1 2 0 0 2 0 0 1 1 1 0 0 2 0 0 1 0 0 -1 2 0 1 3 0 0 1 0 0 0 3 0 1 -1 -1 -1 0 0 0 0 1 0 0 -1 0 2 0 0 0 1 0 0 1 0 0 0 0 0 0 0 -1 0 1 5 1 2...

output:

49

result:

ok single line: '49'

Test #48:

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

input:

259
3 2 0 0 1 1 0 1 1 -1 0 0 1 -1 1 0 2 0 1 0 0 3 0 0 0 1 0 0 0 0 1 1 -1 1 2 3 2 -1 1 2 1 1 1 3 0 0 0 0 0 1 0 0 0 0 0 6 0 -1 0 0 1 2 2 -1 1 0 0 1 0 0 0 0 1 0 0 0 1 1 -1 1 1 0 1 4 2 1 3 0 1 1 0 2 1 1 3 5 1 0 1 0 0 0 1 1 0 0 4 0 0 0 0 0 0 0 3 0 0 1 1 0 0 0 1 0 0 3 0 5 2 0 0 3 2 2 0 4 0 2 0 0 0 2 4 1 3...

output:

143

result:

ok single line: '143'

Test #49:

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

input:

229
0 0 4 0 0 0 1 0 0 1 1 0 -1 0 3 0 -1 -1 1 0 4 0 0 -1 1 1 0 3 -1 0 0 0 2 -1 0 -1 -1 0 0 0 -1 1 1 2 0 3 1 0 0 0 0 2 2 5 2 0 0 1 1 -1 2 0 0 0 0 3 0 0 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 -1 0 0 0 0 -1 0 0 -1 1 0 1 0 2 1 -1 2 0 2 1 -1 0 0 0 1 -1 -1 2 0 -1 0 0 0 -1 -1 2 1 3 1 0 1 1 0 0 1 0 6 -1 -1 0 2 0 0 3 ...

output:

68

result:

ok single line: '68'

Test #50:

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

input:

273
10 -1 12 3 36 21 3 -1 0 37 20 1 0 -1 7 52 33 35 7 25 2 22 16 15 3 20 6 -1 1 0 8 4 19 16 8 27 26 31 9 0 4 11 2 15 34 37 10 7 2 -1 2 11 12 3 9 23 0 0 -1 19 12 -1 7 -1 0 6 -1 17 12 -1 11 3 22 7 21 28 18 3 4 2 3 17 10 19 1 10 9 3 6 12 8 32 26 13 -1 10 86 -1 10 53 22 0 -1 3 0 9 1 16 -1 3 0 5 -1 22 4 ...

output:

2685

result:

ok single line: '2685'

Test #51:

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

input:

286
2 -1 5 20 2 20 1 11 -1 25 1 4 8 26 18 0 14 9 -1 -1 17 11 3 15 20 11 19 25 9 -1 10 17 0 -1 5 7 9 2 2 1 4 5 27 -1 1 20 3 11 6 0 3 -1 1 10 21 -1 2 16 1 1 -1 12 3 7 2 4 2 6 36 9 7 29 8 16 14 0 6 13 43 26 28 0 5 12 12 6 1 26 -1 2 -1 6 8 0 21 5 0 3 -1 9 39 37 29 9 0 26 11 6 6 4 3 1 10 -1 6 0 4 0 0 1 1...

output:

2254

result:

ok single line: '2254'

Test #52:

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

input:

211
1 17 23 7 7 24 8 3 0 0 4 3 5 12 2 17 1 -1 -1 25 2 3 8 19 0 14 8 38 -1 39 3 10 9 8 10 13 6 6 9 5 8 13 8 0 0 25 8 14 8 33 21 0 5 3 11 10 10 12 5 7 19 21 -1 8 9 3 28 12 0 10 3 13 18 4 1 10 0 -1 3 10 -1 1 26 44 1 1 15 38 7 -1 3 22 2 17 0 48 0 16 5 11 6 0 -1 29 7 8 3 10 4 0 2 7 8 7 9 -1 2 17 18 1 29 ...

output:

1959

result:

ok single line: '1959'

Test #53:

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

input:

281
85 92 26 111 307 269 51 160 58 476 109 180 12 108 300 9 77 109 8 62 399 165 110 37 43 24 25 121 21 64 80 105 134 17 233 71 248 37 186 269 210 42 10 115 3 104 23 245 36 15 46 158 75 -1 21 165 64 22 32 11 79 332 4 433 32 40 170 1027 9 3 54 340 111 95 43 80 76 21 47 81 66 50 53 71 33 37 10 19 148 5...

output:

26676

result:

ok single line: '26676'

Test #54:

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

input:

280
501 137 -1 213 131 13 29 286 542 16 503 78 -1 37 17 -1 524 44 239 89 34 46 443 24 0 219 10 164 5 22 -1 144 -1 41 98 72 -1 63 306 8 68 302 106 16 56 308 130 -1 14 -1 -1 -1 -1 4 93 132 367 276 445 98 14 126 32 -1 -1 36 11 39 64 158 210 3 -1 251 89 5 -1 69 3 581 40 -1 138 19 49 139 3 151 72 205 105...

output:

33152

result:

ok single line: '33152'

Test #55:

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

input:

255
263 103 523 18 59 476 104 215 182 121 150 104 854 433 340 147 377 71 128 610 120 386 310 1345 275 216 213 1 738 182 234 70 452 53 -1 116 1243 518 165 15 -1 621 563 12 61 19 146 285 126 535 160 196 31 855 21 88 210 446 155 561 734 38 222 22 22 56 393 52 107 -1 46 55 59 132 764 7 249 1010 382 82 1...

output:

62378

result:

ok single line: '62378'

Test #56:

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

input:

295
-1 0 0 -1 3 0 0 0 0 0 0 -1 5 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0

result:

ok single line: '0'

Test #57:

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

input:

208
0 1 0 2 1 -1 0 1 -1 0 0 0 7 -1 7 0 2 2 1 0 1 2 -1 0 9 6 1 1 3 0 9 3 -1 0 3 0 1 2 -1 4 3 -1 0 2 5 1 9 12 1 0 2 1 0 3 2 8 3 0 0 2 0 0 1 0 7 1 3 0 1 1 0 2 3 0 1 0 0 1 0 6 3 2 1 0 1 7 2 3 0 0 0 1 1 0 0 0 0 1 0 2 0 0 6 0 0 0 2 -1 3 0 0 1 8 2 8 0 2 2 1 1 0 1 3 0 2 0 2 0 0 4 -1 3 1 2 5 2 8 0 2 5 0 1 2 ...

output:

325

result:

ok single line: '325'

Test #58:

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

input:

278
2 2 3 2 0 2 0 0 5 5 0 0 1 0 7 9 4 1 1 2 1 2 1 6 1 1 5 1 3 1 7 1 2 0 -1 0 0 0 1 0 1 5 3 1 3 0 6 0 0 1 0 0 1 0 4 0 5 2 0 0 0 -1 0 -1 0 0 0 4 3 5 0 3 2 2 -1 2 1 1 -1 3 2 4 5 0 1 2 -1 2 1 0 7 6 1 8 5 2 2 1 0 3 0 0 0 1 0 0 3 5 0 0 1 2 2 0 2 1 1 0 1 2 -1 0 2 0 1 0 0 0 -1 3 4 0 2 0 2 0 1 5 2 6 0 0 2 1 ...

output:

351

result:

ok single line: '351'

Test #59:

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

input:

224
3 0 10 4 0 3 2 1 0 6 0 4 1 0 2 3 12 0 3 0 1 3 0 4 0 2 2 4 3 5 0 0 3 0 1 1 5 1 0 2 1 1 2 6 0 4 2 10 1 1 10 2 11 2 5 1 1 -1 5 7 1 1 3 5 1 0 3 0 4 5 0 6 1 0 -1 2 9 4 0 4 13 2 2 1 0 0 0 0 2 1 0 0 10 1 -1 3 2 1 2 2 4 1 0 12 0 3 5 0 2 0 1 1 6 4 4 1 2 4 0 4 11 -1 1 8 3 0 3 1 1 1 1 0 1 2 15 2 5 1 5 6 0 ...

output:

471

result:

ok single line: '471'

Test #60:

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

input:

261
8 21 5 20 35 17 5 -1 0 44 -1 19 20 10 23 22 15 -1 1 21 5 10 0 -1 1 34 11 17 -1 54 6 26 29 32 7 8 3 0 8 8 12 17 22 30 21 12 24 8 16 15 5 0 28 34 9 12 6 20 6 20 7 10 49 48 36 44 7 22 13 1 25 46 21 16 6 1 39 1 12 98 45 7 18 6 2 17 9 2 0 11 0 7 5 11 28 0 30 24 2 2 10 2 0 31 16 1 16 12 1 12 31 30 10 ...

output:

4030

result:

ok single line: '4030'

Test #61:

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

input:

273
1 4 2 2 1 2 1 2 3 1 0 2 0 2 0 0 0 2 2 0 1 0 1 0 4 0 1 3 3 -1 4 1 1 0 1 0 2 0 3 2 2 0 0 0 0 0 2 2 1 1 0 1 0 0 3 0 2 0 0 1 2 0 0 0 0 0 0 0 -1 0 -1 0 0 1 0 0 -1 2 -1 2 1 -1 1 1 0 0 0 0 1 7 0 1 2 1 0 0 0 1 0 2 1 1 1 -1 0 3 1 0 0 1 0 1 1 5 5 2 1 2 0 3 0 0 0 0 4 1 0 1 0 0 1 1 2 0 0 2 6 1 0 0 4 1 5 0 0...

output:

172

result:

ok single line: '172'

Test #62:

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

input:

275
5 2 0 1 5 0 1 6 0 0 2 -1 2 8 7 13 0 0 1 8 2 4 1 9 0 0 9 4 2 4 1 0 1 0 1 5 3 0 1 5 5 1 0 0 3 0 2 1 2 0 7 0 2 5 2 1 4 1 1 0 9 1 2 8 0 8 2 1 13 3 2 1 1 1 3 0 6 0 3 3 6 -1 1 3 17 4 5 3 4 0 12 0 0 10 2 8 9 0 3 4 3 7 1 1 0 0 8 8 -1 3 -1 2 0 0 0 0 5 0 -1 4 2 0 0 0 10 0 1 1 4 0 2 0 1 2 0 2 3 8 6 0 3 4 1...

output:

631

result:

ok single line: '631'

Subtask #4:

score: 25
Accepted

Test #63:

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

input:

4937
0 1 -1 1 0 -1 1 0 1 0 1 0 0 0 0 0 0 0 1 1 -1 1 0 -1 1 1 0 0 0 1 0 0 1 -1 0 -1 0 1 -1 0 0 0 0 0 -1 0 1 0 1 0 0 0 0 1 0 1 1 1 1 -1 0 1 0 -1 0 1 -1 1 -1 0 0 1 1 1 0 -1 1 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 1 -1 0 1 -1 -1 0 1 -1 -1 1 1 1 1 1 0 0 1 0 0 0 1 1 0 0 0 0 0 1 1 1 1 1 -1 0 0 1 0 1 1 1 -1 -1 0 0 ...

output:

22

result:

ok single line: '22'

Test #64:

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

input:

4976
2 1 1 7 0 6 2 3 0 0 5 4 0 1 0 0 0 4 0 1 3 3 3 3 4 8 1 3 0 0 1 -1 0 0 15 0 4 7 4 3 4 5 0 6 2 1 1 1 0 0 3 3 0 10 0 4 -1 0 1 0 -1 -1 -1 0 0 4 0 0 6 -1 8 7 1 5 1 1 0 5 1 3 1 4 -1 1 4 1 0 0 5 1 7 1 0 4 -1 6 3 2 1 1 6 -1 5 -1 0 7 1 0 2 -1 0 4 3 1 2 4 1 -1 2 8 2 2 0 6 3 1 2 0 -1 2 1 2 1 5 0 4 -1 2 0 0...

output:

7234

result:

ok single line: '7234'

Test #65:

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

input:

4984
0 2 0 0 0 -1 1 0 0 3 0 1 0 0 0 0 0 0 0 0 1 0 0 2 0 0 0 0 0 -1 0 0 -1 0 0 3 0 -1 1 0 -1 0 0 0 0 1 0 0 0 0 0 0 2 0 0 -1 0 0 0 0 0 -1 1 1 2 0 0 0 0 0 2 1 1 1 1 2 0 -1 1 1 -1 1 1 6 0 0 0 0 -1 0 0 0 0 0 0 2 1 1 0 3 0 0 -1 0 0 1 1 0 0 1 5 1 0 0 1 1 4 0 2 1 0 -1 1 1 0 0 0 -1 0 0 2 0 1 -1 1 2 0 3 2 0 0...

output:

760

result:

ok single line: '760'

Test #66:

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

input:

4935
5 1 -1 -1 0 0 -1 -1 0 0 0 0 1 0 0 -1 2 1 0 0 0 0 0 4 -1 2 0 -1 -1 0 0 0 1 0 -1 0 0 1 1 0 -1 0 1 1 1 0 -1 0 -1 -1 0 0 1 0 -1 0 -1 -1 2 0 0 0 1 3 1 0 0 2 -1 0 0 0 0 1 5 0 2 -1 0 3 1 3 2 2 0 3 0 0 4 1 0 11 -1 2 -1 0 -1 1 0 0 0 -1 2 0 0 0 -1 -1 0 2 0 -1 11 0 -1 1 -1 0 -1 0 3 -1 1 0 -1 0 0 1 0 0 4 5...

output:

2156

result:

ok single line: '2156'

Test #67:

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

input:

4999
0 0 1 0 1 0 0 0 2 0 0 -1 1 0 1 1 0 0 0 1 -1 1 0 0 0 0 3 0 0 1 2 1 2 0 2 2 0 1 1 3 2 0 1 0 1 -1 0 1 0 0 3 2 1 1 0 0 0 0 1 1 0 1 0 0 0 -1 1 0 0 0 0 1 0 3 3 3 0 3 3 3 2 1 0 0 1 1 1 0 1 1 1 1 4 7 1 1 1 1 2 0 1 1 1 1 3 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 8 1 1 1 0 1 1 1 1 0 0 0 2 0 4 0 0 0 0 0 0 0 0 0 0 1...

output:

2515

result:

ok single line: '2515'

Test #68:

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

input:

4909
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 0 0 3 2 0 1 4 0 0 2 1 8 0 0 0 4 1 0 1 -1 -1 0 0 1 1 0 0 0 1 3 1 6 0 -1 0 2 0 0 0 -1 0 -1 0 1 0 0 0 -1 -1 0 0 2 0 0 -1 0 -1 0 0 1 2 0 0 -1 0 2 0 -1 1 0 1 0 -1 -1 -1 0 0 0 0 0 0 0 1 1 1 0 -1 -1 0 0 2 0 0 3 0 -1 -1 0 0 0 0 0 2 0 3 -1 -1 0 1 1 0 0 -1 0 0 0 0 0...

output:

1085

result:

ok single line: '1085'

Test #69:

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

input:

4983
0 0 0 -1 0 1 0 0 -1 4 -1 -1 0 1 0 -1 -1 6 1 2 -1 0 1 0 3 1 0 0 0 -1 4 0 5 2 0 0 2 1 0 5 0 1 5 0 2 -1 2 3 0 0 2 -1 0 0 5 0 0 -1 -1 1 1 0 0 3 1 1 6 3 0 1 0 1 -1 2 -1 0 8 0 0 0 0 0 0 0 4 1 3 2 2 0 3 1 4 1 -1 4 2 1 2 0 0 1 -1 1 -1 0 3 0 0 -1 1 0 -1 1 0 0 -1 0 0 -1 0 1 0 -1 0 6 0 1 2 -1 3 0 0 -1 -1 ...

output:

1985

result:

ok single line: '1985'

Test #70:

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

input:

4989
2 0 0 4 1 1 2 5 1 2 0 1 1 0 0 0 0 0 0 4 -1 2 -1 0 2 -1 1 1 5 0 2 2 0 5 1 2 3 0 -1 6 0 0 2 1 3 -1 2 0 0 1 0 0 0 0 0 1 -1 6 5 0 1 0 0 3 2 1 2 0 0 1 1 0 0 0 0 4 0 0 4 2 0 0 0 2 -1 2 1 0 1 0 1 7 2 0 1 3 0 1 -1 2 -1 2 -1 1 1 0 0 0 1 0 0 2 1 1 0 -1 -1 3 0 7 0 1 0 0 1 1 3 2 0 2 1 1 -1 3 2 1 4 0 4 1 2 ...

output:

3147

result:

ok single line: '3147'

Test #71:

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

input:

4989
491 1024 471 624 715 9 463 1169 753 479 169 492 538 837 676 -1 294 394 997 102 930 199 460 609 1245 -1 -1 47 2328 42 5549 -1 1761 244 1966 344 278 797 766 1557 -1 1887 648 1056 552 4115 948 2675 993 241 -1 228 62 393 231 13 165 865 12 1576 129 9 161 457 197 822 901 855 1442 3160 101 1037 -1 692...

output:

3134998

result:

ok single line: '3134998'

Test #72:

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

input:

4922
117 261 55 24 82 39 77 34 738 60 476 25 320 13 -1 38 206 29 1411 294 329 8 426 251 87 412 138 346 22 127 350 35 7 -1 176 417 49 556 82 307 161 167 247 202 146 55 265 113 327 38 246 45 354 283 62 267 36 389 3 16 916 -1 40 318 651 1465 38 65 388 30 38 102 67 88 608 271 97 167 242 343 217 71 335 1...

output:

1127746

result:

ok single line: '1127746'

Test #73:

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

input:

4944
412 377 171 162 281 229 58 505 24 33 186 188 13 213 103 340 63 2 10 93 241 503 171 20 40 332 1 269 14 111 44 15 201 156 174 6 140 212 274 71 86 311 14 339 20 32 482 -1 76 161 24 15 11 2 51 77 100 54 151 90 116 242 66 95 16 102 146 156 236 154 -1 47 539 9 39 46 96 248 85 152 0 197 105 72 146 232...

output:

713430

result:

ok single line: '713430'

Test #74:

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

input:

4953
705 -1 725 377 -1 643 212 1738 786 577 534 318 176 347 117 1205 144 196 941 839 127 861 45 701 0 388 156 379 556 1100 270 973 367 466 227 46 86 458 327 -1 69 133 750 392 83 174 938 473 167 -1 443 1238 26 734 220 8 770 328 693 1410 217 1874 1368 84 68 418 911 55 3025 1083 47 -1 214 670 260 164 1...

output:

2450117

result:

ok single line: '2450117'

Test #75:

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

input:

4995
-1 0 0 -1 3 0 0 0 0 0 0 -1 5 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

0

result:

ok single line: '0'

Test #76:

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

input:

4914
6 6 0 4 9 4 2 1 4 10 0 0 0 -1 5 -1 0 0 1 0 1 2 1 2 3 6 8 0 0 4 5 4 1 0 4 2 2 -1 0 -1 12 1 2 0 0 2 0 2 0 1 -1 4 2 1 3 1 2 0 5 -1 1 0 5 0 0 0 3 0 2 4 0 0 -1 3 1 2 0 0 0 0 1 0 1 0 3 3 2 7 3 3 1 0 1 2 0 3 5 1 4 0 0 2 2 1 0 0 0 2 8 1 1 1 0 3 6 0 0 1 -1 3 0 0 1 2 3 1 4 1 2 5 0 1 1 2 3 4 1 0 0 2 1 -1 ...

output:

6428

result:

ok single line: '6428'

Test #77:

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

input:

4991
0 0 0 0 2 3 2 0 0 0 0 2 3 1 -1 1 0 -1 0 0 0 0 1 2 0 0 1 2 6 1 0 1 2 2 8 1 0 4 0 0 0 3 2 -1 1 0 4 4 0 0 3 1 3 1 0 1 0 -1 0 1 0 0 0 0 2 3 0 -1 0 2 0 3 3 2 0 1 1 1 2 0 0 0 1 0 0 -1 0 2 0 -1 -1 3 0 0 1 2 0 0 2 -1 0 6 0 0 0 0 0 0 -1 1 0 1 12 0 0 4 -1 0 1 0 2 5 4 1 -1 1 0 2 2 7 0 3 4 0 0 0 0 1 0 0 0 ...

output:

6470

result:

ok single line: '6470'

Test #78:

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

input:

5000
1 -1 1 0 0 0 0 2 1 0 6 0 0 6 2 0 0 0 0 0 0 1 1 3 3 0 1 4 10 4 2 2 2 0 5 3 0 3 0 4 0 0 1 2 0 1 1 3 0 0 -1 0 1 0 0 1 1 1 1 1 0 0 1 0 0 0 2 0 4 1 3 0 0 5 1 0 1 0 2 2 1 3 1 0 0 0 0 2 0 1 0 1 5 1 -1 -1 0 0 6 2 4 1 4 0 0 9 0 0 0 0 0 0 8 0 0 3 0 0 3 0 0 10 0 4 3 0 1 5 3 0 -1 0 -1 7 0 1 3 5 2 0 0 0 0 -...

output:

7184

result:

ok single line: '7184'

Test #79:

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

input:

4943
0 0 2 3 1 5 4 2 3 3 1 0 1 5 7 0 27 2 4 3 -1 3 0 4 -1 6 0 2 1 7 0 2 0 2 6 0 1 0 0 2 1 5 1 3 5 2 6 0 6 1 2 3 0 1 0 0 4 8 -1 -1 2 1 0 2 9 1 3 0 0 2 7 1 0 0 1 0 3 1 1 1 7 1 0 1 0 0 2 0 1 0 -1 7 0 0 1 4 0 -1 1 0 0 2 0 0 1 0 4 4 0 0 2 2 3 1 2 2 -1 0 3 3 6 2 0 0 0 1 0 3 2 4 0 5 0 0 4 9 -1 8 0 0 1 1 11...

output:

6630

result:

ok single line: '6630'

Test #80:

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

input:

4933
6 0 1 3 1 -1 1 2 3 0 3 3 0 1 0 0 1 1 0 2 0 0 1 0 9 2 1 3 0 0 1 0 0 0 1 0 4 1 0 1 -1 5 5 2 1 1 1 4 0 -1 4 2 1 2 0 5 4 -1 0 0 0 1 0 0 0 3 3 0 1 0 1 1 0 0 0 1 4 0 1 0 0 0 1 1 1 0 0 0 1 2 0 0 1 4 0 1 0 1 0 0 1 1 0 2 1 5 0 3 0 1 -1 3 2 0 1 0 0 2 1 5 6 -1 13 1 0 0 2 1 1 2 2 0 0 0 4 3 -1 0 0 0 0 0 0 0...

output:

4217

result:

ok single line: '4217'

Test #81:

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

input:

4950
1 2 0 0 2 -1 -1 0 2 -1 14 1 0 3 2 1 1 0 2 0 0 3 2 0 0 3 1 1 0 0 -1 2 0 1 5 2 5 1 0 0 0 5 0 1 0 0 4 2 0 0 2 0 -1 2 0 1 2 0 7 3 0 1 1 5 0 1 1 4 0 2 1 1 1 0 0 0 2 0 0 0 2 0 5 0 1 3 2 0 1 0 1 1 0 0 0 0 3 0 0 2 0 3 7 1 0 7 1 4 0 0 0 1 5 2 0 0 2 2 7 4 1 -1 0 12 0 0 0 2 0 0 1 3 0 0 0 3 3 0 0 0 0 1 0 2...

output:

4710

result:

ok single line: '4710'

Test #82:

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

input:

4994
0 0 3 3 2 0 2 0 1 0 2 1 2 0 2 6 0 2 1 4 4 0 0 1 0 0 6 0 1 3 1 0 0 1 0 0 0 -1 1 0 0 0 3 0 9 5 1 3 -1 0 1 1 0 0 0 2 0 2 0 0 0 3 2 7 0 1 0 2 2 0 0 0 0 0 2 0 0 1 0 2 3 -1 -1 0 0 0 2 15 2 -1 1 0 1 10 1 0 0 -1 0 4 9 0 0 2 4 1 0 1 0 0 0 0 0 0 3 1 2 0 0 9 4 0 1 0 0 4 -1 1 0 4 0 0 5 0 1 0 1 2 0 5 0 1 1 ...

output:

5413

result:

ok single line: '5413'

Test #83:

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

input:

4941
0 4 4 5 7 0 3 7 8 12 1 3 1 0 2 0 0 5 6 6 1 0 1 1 2 2 0 0 3 2 1 9 19 0 4 5 1 2 0 3 1 0 0 2 -1 1 1 0 5 2 1 1 3 0 0 0 0 2 5 5 0 2 6 2 6 4 2 2 1 6 3 4 1 1 4 7 10 3 1 4 10 1 -1 6 2 1 3 0 1 0 -1 5 0 2 0 0 3 2 -1 1 2 6 2 4 3 1 8 4 15 3 0 6 2 0 4 0 0 0 3 0 1 7 -1 0 1 6 0 0 0 0 0 1 3 1 2 9 0 -1 1 0 0 0 ...

output:

10634

result:

ok single line: '10634'

Test #84:

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

input:

4950
5001 5002 0 0 2 -1 -1 0 5002 -1 5014 5001 0 5003 5002 5001 5001 0 5002 0 0 5003 5002 0 0 5003 5001 1 0 0 -1 2 0 1 5005 5002 5005 5001 0 0 0 5005 0 5001 0 0 5004 5002 0 0 2 0 -1 2 0 1 5002 0 5007 5003 0 5001 5001 5005 0 5001 5001 5004 0 5002 5001 5001 5001 0 0 0 5002 0 0 0 5002 0 5005 0 5001 500...

output:

10268677

result:

ok single line: '10268677'

Test #85:

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

input:

4994
0 0 5003 5003 5002 0 5002 0 5001 0 5002 5001 5002 0 5002 5006 0 5002 5001 5004 5004 0 0 5001 0 0 5006 0 5001 5003 5001 0 0 5001 0 0 0 -1 1 0 0 0 5003 0 5009 5005 1 3 -1 0 1 5001 0 0 0 5002 0 5002 0 0 0 5003 5002 5007 0 5001 0 5002 5002 0 0 0 0 0 5002 0 0 5001 0 2 3 -1 -1 0 0 0 5002 5015 2 -1 1 ...

output:

11074437

result:

ok single line: '11074437'

Test #86:

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

input:

5000
5001 -1 1 0 0 0 0 5002 5001 0 5006 0 0 5006 5002 0 0 0 0 0 0 5001 5001 5003 5003 0 5001 5004 5010 5004 5002 5002 5002 0 5005 5003 0 5003 0 5004 0 0 5001 5002 0 5001 5001 5003 0 0 -1 0 1 0 0 5001 5001 5001 5001 5001 0 0 5001 0 0 0 5002 0 5004 5001 5003 0 0 5005 5001 0 5001 0 5002 5002 5001 5003 ...

output:

12716356

result:

ok single line: '12716356'

Test #87:

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

input:

4941
0 5004 5004 5005 5007 0 5003 5007 5008 5012 5001 5003 5001 0 5002 0 0 5005 5006 5006 5001 0 5001 5001 5002 5002 0 0 5003 5002 5001 5009 5019 0 5004 5005 5001 5002 0 5003 5001 0 0 2 -1 1 1 0 5005 5002 5001 5001 5003 0 0 0 0 5002 5005 5005 0 5002 5006 5002 5006 5004 5002 5002 5001 5006 5003 5004 ...

output:

14670111

result:

ok single line: '14670111'

Test #88:

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

input:

4933
5006 0 5001 5003 1 -1 1 5002 5003 0 5003 5003 0 5001 0 0 5001 5001 0 5002 0 0 5001 0 5009 5002 5001 5003 0 0 5001 0 0 0 5001 0 5004 5001 0 1 -1 5 5 5002 5001 5001 5001 5004 0 -1 4 5002 5001 5002 0 5005 4 -1 0 0 0 5001 0 0 0 5003 5003 0 5001 0 5001 5001 0 0 0 5001 5004 0 5001 0 0 0 5001 5001 500...

output:

9758094

result:

ok single line: '9758094'

Subtask #5:

score: 27
Accepted

Test #89:

score: 27
Accepted
time: 235ms
memory: 41120kb

input:

499952
-1 3 0 0 3 0 -1 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 -1 0 0 0 0 0 0 0 3 0 0 0 0 -1 0 0 0 0 4 2 0 -1 0 0 0 0 0 0 1 0 1 0 -1 0 0 0 0 -1 2 0 0 0 0 0 1 0 -1 -1 0 0 0 3 0 0 0 0 0 0 0 -1 0 -1 0 0 0 -1 1 -1 -1 0 2 3 -1 0 -1 2 1 0 0 0 -1 -1 0 0 0 1 0 0 0 0 0 0 0 0 0 -1 -1 0 -1 -1 0 ...

output:

15

result:

ok single line: '15'

Test #90:

score: 0
Accepted
time: 224ms
memory: 41128kb

input:

499944
2 0 0 -1 -1 1 0 0 -1 -1 0 -1 -1 -1 1 0 1 0 0 0 0 1 -1 0 0 0 0 2 0 -1 -1 1 -1 0 0 0 0 0 0 0 4 0 0 2 0 0 -1 0 0 0 0 0 0 -1 -1 1 -1 0 0 0 4 0 1 0 1 0 7 0 0 0 -1 0 0 0 -1 0 -1 0 0 0 -1 0 -1 0 1 -1 0 -1 0 0 -1 0 -1 3 0 5 1 0 -1 0 1 0 0 -1 0 -1 8 -1 0 0 -1 0 0 -1 1 0 0 0 0 0 0 -1 -1 1 2 0 1 0 0 -1 ...

output:

17

result:

ok single line: '17'

Test #91:

score: 0
Accepted
time: 242ms
memory: 41276kb

input:

499977
-1 0 1 -1 0 1 0 0 0 0 -1 -1 0 2 1 0 0 0 0 0 0 -1 -1 1 -1 0 -1 0 2 0 -1 2 0 1 0 0 -1 0 0 0 0 2 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 2 1 0 2 0 0 0 0 0 0 -1 0 -1 0 -1 0 1 3 0 0 0 2 -1 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0 0 2 2 -1 0 0 0 0 -1 0 1 0 0 -1 0 0 2 -1 -1 -1 -1 0 0 0 0 0 4 1 0 0 0 0 0 0 0 ...

output:

4

result:

ok single line: '4'

Test #92:

score: 0
Accepted
time: 336ms
memory: 44952kb

input:

499978
2 -1 0 2 0 -1 0 3 0 -1 0 0 0 2 1 3 0 3 1 6 0 3 0 5 -1 2 -1 0 0 -1 0 0 1 -1 0 2 1 0 0 -1 0 0 -1 -1 0 4 3 -1 -1 0 -1 0 1 0 0 2 0 0 1 -1 5 0 1 1 0 0 2 2 0 -1 3 2 0 0 0 2 0 3 -1 0 2 0 -1 0 -1 2 0 0 1 -1 0 -1 0 0 -1 1 2 0 0 -1 1 -1 0 0 0 0 0 4 0 -1 -1 0 1 -1 -1 5 -1 -1 0 -1 0 4 4 0 -1 1 -1 2 4 0 0...

output:

92194

result:

ok single line: '92194'

Test #93:

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

input:

499921
0 -1 0 1 5 3 0 2 0 0 0 -1 -1 -1 1 0 1 4 -1 1 -1 0 0 0 -1 -1 0 -1 0 2 -1 -1 4 -1 1 -1 0 -1 -1 0 0 -1 4 -1 1 -1 0 0 0 0 1 -1 1 1 5 1 0 0 0 3 0 2 0 0 0 -1 0 0 0 0 1 -1 2 0 2 0 0 1 2 0 0 0 -1 -1 0 0 0 1 0 -1 0 1 1 0 0 -1 5 0 0 1 0 -1 1 3 2 0 0 0 3 -1 0 -1 0 0 -1 0 -1 -1 -1 0 1 0 1 1 2 0 0 2 -1 0 ...

output:

93796

result:

ok single line: '93796'

Test #94:

score: 0
Accepted
time: 342ms
memory: 44988kb

input:

499983
-1 1 0 6 1 0 0 -1 0 0 -1 -1 -1 0 -1 0 0 1 1 0 0 0 0 0 3 0 -1 -1 0 2 7 2 0 0 0 0 -1 0 0 -1 -1 0 2 -1 1 0 0 -1 1 1 -1 0 0 6 0 -1 -1 0 0 -1 0 2 1 5 -1 0 5 1 0 0 0 0 0 0 2 0 0 1 -1 0 5 3 -1 2 0 0 1 3 1 0 1 0 1 0 0 0 0 0 1 4 5 -1 1 4 1 0 0 8 0 -1 0 1 -1 0 0 -1 0 0 3 0 0 0 -1 2 0 0 0 0 -1 -1 -1 1 0...

output:

93232

result:

ok single line: '93232'

Test #95:

score: 0
Accepted
time: 275ms
memory: 41208kb

input:

499976
0 0 -1 1 0 1 0 1 0 0 0 -1 0 -1 0 2 -1 -1 0 0 0 4 0 -1 0 1 0 0 0 0 0 -1 0 0 0 -1 0 0 0 -1 -1 -1 4 2 0 0 0 0 0 -1 0 -1 0 -1 0 0 1 -1 -1 0 0 -1 0 -1 -1 0 0 -1 0 0 0 -1 0 0 0 0 2 1 0 -1 -1 0 0 2 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 2 -1 1 0 -1 1 0 0 3 1 0 0 2 0 0 0 5 0 -1 0 -1 -1 0 -1 0 0 0 -1 0 -1 ...

output:

3464

result:

ok single line: '3464'

Test #96:

score: 0
Accepted
time: 276ms
memory: 41368kb

input:

499912
0 -1 0 0 0 1 -1 0 0 0 0 0 0 -1 0 0 0 -1 0 0 0 0 0 0 -1 0 0 0 0 -1 0 0 -1 0 0 1 0 1 0 0 2 0 -1 0 0 0 1 1 2 -1 -1 0 1 2 -1 0 0 -1 -1 -1 0 0 0 0 0 1 0 1 0 -1 0 0 1 1 -1 0 0 -1 2 0 -1 1 1 -1 -1 -1 0 -1 1 0 0 2 -1 0 -1 0 1 -1 -1 0 2 -1 0 0 1 1 0 1 0 0 -1 1 0 0 -1 1 -1 1 2 1 -1 0 2 3 -1 0 -1 0 1 -1...

output:

17675

result:

ok single line: '17675'

Test #97:

score: 0
Accepted
time: 295ms
memory: 43676kb

input:

499979
0 -1 -1 4 2 0 0 0 1 1 0 0 1 0 2 0 -1 0 2 1 0 1 0 0 0 2 2 0 0 1 1 2 1 0 0 0 -1 0 4 -1 1 -1 2 0 4 0 0 1 0 2 -1 0 2 1 1 2 0 2 -1 0 2 2 -1 0 1 0 0 3 3 1 0 0 1 0 2 0 0 1 -1 0 4 -1 3 0 1 0 0 -1 1 0 0 3 1 1 0 2 8 2 -1 1 1 -1 4 0 -1 2 3 0 1 0 0 1 1 1 0 6 0 0 1 0 1 1 2 0 0 0 5 0 3 0 1 0 0 0 3 0 -1 -1 ...

output:

174474

result:

ok single line: '174474'

Test #98:

score: 0
Accepted
time: 245ms
memory: 42268kb

input:

499994
4 0 0 1 0 0 1 -1 2 1 1 1 2 1 0 0 1 3 1 2 0 0 1 1 0 1 0 1 0 0 0 1 1 1 0 2 4 0 6 0 0 0 3 1 0 7 0 5 1 0 0 1 0 0 0 0 2 1 1 2 1 0 1 1 0 3 -1 1 2 0 0 5 0 1 -1 2 -1 0 0 2 0 0 -1 0 0 1 0 0 2 0 0 0 0 0 6 3 0 0 1 3 0 4 1 4 0 0 0 0 2 0 0 0 2 0 4 3 3 1 0 0 1 0 1 3 0 2 2 0 2 0 1 1 1 1 0 0 2 0 0 0 0 0 0 0 ...

output:

429970

result:

ok single line: '429970'

Test #99:

score: 0
Accepted
time: 483ms
memory: 49232kb

input:

499918
-1 902 7 272 1690 7 76 46 418 69 896 206 2658 14 26 379 41 536 592 1 360 325 1659 0 166 316 138 430 -1 26 709 938 169 790 419 83 373 169 229 825 884 92 736 61 600 333 1185 116 435 111 366 -1 355 213 250 573 427 107 13 701 592 1206 327 121 363 258 745 463 858 824 269 44 215 1057 202 1463 726 4...

output:

224849334

result:

ok single line: '224849334'

Test #100:

score: 0
Accepted
time: 489ms
memory: 49688kb

input:

499976
-1 28 25 103 5 306 53 324 71 100 18 173 140 148 134 51 189 72 -1 69 184 351 34 137 33 16 69 38 7 26 229 117 188 126 74 221 21 19 145 8 1 22 32 79 63 189 11 137 85 119 12 211 15 133 438 44 157 6 98 -1 5 166 41 531 5 88 157 306 156 97 134 10 97 107 260 107 20 53 114 29 83 -1 240 160 183 50 310 ...

output:

49264157

result:

ok single line: '49264157'

Test #101:

score: 0
Accepted
time: 470ms
memory: 49120kb

input:

499984
164 17 399 275 248 146 11 18 55 253 203 43 -1 59 170 177 399 126 304 288 75 19 292 275 378 7 63 138 41 485 443 433 172 115 288 104 -1 139 8 72 247 1 133 288 129 132 168 188 809 318 180 60 11 84 288 58 43 65 212 178 422 85 15 147 11 26 49 36 119 36 171 246 251 23 -1 -1 412 144 743 92 53 550 23...

output:

72547315

result:

ok single line: '72547315'

Test #102:

score: 0
Accepted
time: 481ms
memory: 48528kb

input:

499966
672 13 226 19 1 976 54 137 382 51 63 295 85 111 47 52 259 95 38 72 13 147 17 53 73 161 128 46 73 24 205 192 6 -1 405 123 316 18 217 9 162 90 219 193 71 102 50 165 90 23 235 319 141 27 201 221 146 126 16 334 45 100 167 3 5 20 202 133 61 181 593 383 41 71 10 49 137 108 37 400 277 41 -1 54 140 2...

output:

82905511

result:

ok single line: '82905511'

Test #103:

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

input:

499555
-1 0 0 -1 3 0 0 0 0 0 0 -1 5 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

0

result:

ok single line: '0'

Test #104:

score: 0
Accepted
time: 21ms
memory: 29456kb

input:

29961
2 1 0 2 -1 4 3 2 3 10 0 0 0 0 1 1 0 2 2 1 6 4 6 3 1 1 5 6 1 10 8 2 0 3 8 8 0 1 10 6 4 3 9 6 4 3 -1 0 4 0 3 6 2 1 2 0 7 1 1 2 10 0 2 -1 1 0 0 0 -1 0 0 1 2 0 6 1 0 2 0 2 0 2 2 1 6 4 1 0 3 0 2 0 1 2 4 0 2 2 5 4 2 3 0 3 4 2 0 7 0 0 5 3 5 2 1 11 3 0 3 1 1 0 1 0 0 0 0 0 0 3 0 -1 2 1 2 4 1 2 1 0 1 5 ...

output:

59521

result:

ok single line: '59521'

Test #105:

score: 0
Accepted
time: 23ms
memory: 29336kb

input:

29961
0 1 5 0 4 0 1 0 0 0 0 2 0 1 0 3 1 8 4 1 4 3 0 -1 4 2 3 1 0 0 -1 0 1 7 3 3 0 0 0 4 -1 3 1 5 3 2 2 3 0 0 2 2 1 0 1 8 1 1 0 0 3 1 1 2 3 0 1 0 0 0 5 2 3 3 0 0 5 1 4 0 1 6 4 0 3 0 1 3 1 3 1 4 0 2 2 1 0 3 0 2 -1 3 0 1 0 0 0 -1 0 8 0 5 0 -1 0 4 0 0 0 2 2 4 0 4 2 2 2 4 4 4 3 2 1 4 0 2 0 1 0 0 10 -1 0 ...

output:

44560

result:

ok single line: '44560'

Test #106:

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

input:

29983
7 0 5 0 0 1 -1 3 2 1 6 2 6 1 2 4 8 0 3 -1 1 3 3 -1 0 2 4 0 0 1 0 0 -1 2 2 2 10 0 5 0 0 1 0 0 0 2 3 4 1 -1 2 0 0 1 2 0 0 0 0 0 6 6 7 3 1 2 2 1 -1 5 3 0 2 5 0 2 0 0 -1 2 0 0 -1 3 0 2 0 0 0 0 1 0 0 1 4 -1 9 2 2 12 3 0 5 1 5 0 2 -1 3 2 0 0 0 0 0 1 0 0 1 4 4 2 0 2 0 2 8 0 4 1 1 0 2 0 1 7 1 10 1 0 0...

output:

45194

result:

ok single line: '45194'

Test #107:

score: 0
Accepted
time: 21ms
memory: 28976kb

input:

29973
2 0 1 2 0 1 2 4 0 0 0 0 2 0 -1 0 3 -1 1 3 0 1 5 0 2 0 1 1 0 6 0 4 3 1 0 0 1 -1 1 4 1 0 1 1 2 0 0 0 0 0 1 0 0 1 2 3 4 1 0 1 1 0 0 2 1 3 0 1 0 0 0 0 3 4 0 0 0 2 0 0 5 0 2 0 1 0 1 0 2 2 0 1 1 2 3 0 0 1 0 0 1 1 2 0 1 1 4 0 1 1 1 1 1 0 1 2 1 1 3 1 0 1 1 4 0 1 4 1 0 2 1 -1 0 9 0 0 1 0 0 0 3 3 1 2 0 ...

output:

17673

result:

ok single line: '17673'

Test #108:

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

input:

29903
10 0 -1 0 0 1 0 0 0 0 1 1 0 0 1 1 5 1 0 0 0 0 0 0 8 2 2 2 3 1 0 0 0 0 0 0 1 0 5 1 0 3 1 0 0 1 0 2 3 0 1 0 1 0 4 1 -1 0 0 1 2 4 6 0 1 0 0 0 2 0 1 0 0 5 0 1 3 2 4 3 0 1 0 0 3 0 0 4 0 6 0 0 2 0 0 0 0 1 0 0 0 1 0 4 0 0 0 1 1 2 1 0 5 0 1 0 0 0 1 3 1 0 0 0 6 -1 0 2 0 5 2 1 0 0 2 -1 1 0 0 1 2 0 2 1 6...

output:

32037

result:

ok single line: '32037'

Test #109:

score: 0
Accepted
time: 132ms
memory: 35616kb

input:

499555
-1 0 0 -1 5003 0 0 0 0 0 0 -1 5005 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

10000

result:

ok single line: '10000'