QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#87665#5741. TriterminantlarryzhongAC ✓20ms10524kbC++17979b2023-03-14 00:18:182023-03-14 00:18:20

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3516kb

input:

3
4
1 1 1 1
2
1 -1
5
-1 1 1 1 -1

output:

2
0
2

result:

ok 3 number(s): "2 0 2"

Test #2:

score: 0
Accepted
time: 19ms
memory: 7148kb

input:

3
27354
-1 -1 1 -1 1 1 1 1 -1 -1 1 1 -1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 -1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 1 1 -1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 ...

output:

13567
27879
7121

result:

ok 3 number(s): "13567 27879 7121"

Test #3:

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

input:

3
27970
1 -1 1 -1 -1 -1 1 1 1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1...

output:

2767
80
6378

result:

ok 3 number(s): "2767 80 6378"

Test #4:

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

input:

3
36019
-1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 -1 1 1 1 -1 1 -1 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 1 ...

output:

7231
6152
5290

result:

ok 3 number(s): "7231 6152 5290"

Test #5:

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

input:

9
20499
-1 -1 1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 -1 1 1 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 1 1 1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 1 1 -1 -1 -1 1 1 1 1 1 -1 -...

output:

6093
6901
2328
11469
915
87
6
1331
86

result:

ok 9 numbers

Test #6:

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

input:

2
94689
1 1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 ...

output:

37779
587

result:

ok 2 number(s): "37779 587"

Test #7:

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

input:

4
90533
-1 -1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 1 -1 -1 1 1 1 1 1 -1 1 -1 1 -1 1...

output:

36192
516
2233
928

result:

ok 4 number(s): "36192 516 2233 928"

Test #8:

score: 0
Accepted
time: 19ms
memory: 8548kb

input:

2
74465
1 -1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 1 1 1 -1 1 1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 1 1 1 1 -1 1 -1 -1 1...

output:

22551
7372

result:

ok 2 number(s): "22551 7372"

Test #9:

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

input:

5
41709
-1 1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 1 1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 1 1 1 1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 -1 1...

output:

8311
8174
2118
148
552

result:

ok 5 number(s): "8311 8174 2118 148 552"

Test #10:

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

input:

5
47359
-1 1 1 -1 1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 -1 1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 1 1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 1 1 -1 1 -1 -1 1 -1 1 1 1 1 -1 -1 1 1 -1 1 -1 -1 ...

output:

4819
2783
44
287
1764

result:

ok 5 number(s): "4819 2783 44 287 1764"

Test #11:

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

input:

1
100000
-1 -1 -1 1 -1 -1 1 1 1 -1 1 1 -1 1 -1 -1 -1 1 -1 1 -1 -1 1 1 1 1 1 1 1 -1 -1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 1 1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 -1 1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 -1...

output:

49773

result:

ok 1 number(s): "49773"

Test #12:

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

input:

1
100000
1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 1 -1 1 1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 -1 1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 1 1 -1 1 1 -1 -1 -1 1 1 -1 1 1 1 1 -1 1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 1 -1...

output:

30144

result:

ok 1 number(s): "30144"

Test #13:

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

input:

1
100000
-1 1 1 -1 -1 1 1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 1 -1 1 1 -1 1 1 -1 1 1 1 -1 1 1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 ...

output:

40103

result:

ok 1 number(s): "40103"

Test #14:

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

input:

1
100000
-1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1...

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 0
Accepted
time: 18ms
memory: 3408kb

input:

100000
1
1
1
-1
1
-1
1
1
1
1
1
1
1
1
1
-1
1
1
1
-1
1
-1
1
1
1
1
1
1
1
1
1
-1
1
-1
1
-1
1
-1
1
1
1
-1
1
1
1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
0
0
1
1
0
1
0
0
0
1
0
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
1
...

result:

ok 66741 numbers

Test #17:

score: 0
Accepted
time: 19ms
memory: 3400kb

input:

50096
2
1 -1
3
1 -1 1
3
1 1 -1
1
1
1
1
1
-1
2
1 1
3
-1 -1 -1
1
1
1
1
2
-1 -1
3
1 -1 -1
1
-1
3
-1 1 1
3
-1 1 -1
1
1
3
1 1 -1
1
-1
2
-1 1
1
-1
3
1 1 -1
3
-1 1 -1
1
1
3
-1 -1 -1
3
1 -1 1
1
1
2
-1 -1
2
1 1
1
-1
1
-1
1
-1
2
1 -1
2
-1 1
2
-1 1
2
-1 1
1
-1
1
-1
3
1 1 1
3
1 -1 -1
2
-1 -1
1
1
2
-1 1
2
1 -1
2...

output:

0
0
1
0
0
0
1
1
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
1
0
0
1
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
1
0
0
1
1
1
1
0
0
1
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
0
1
0
0
1
0
0
1
1
0
0
1
1
0
1
1
0
0
1
0
1
1
0
0
1
0
0
1
0
1
0
0
0
1
0
1
0
0
0
0
0
0
1
0
0
1
0
1
1
0
1
0
0
1
0
0
0
0
0
0
0
1
0
0
0
1
0
...

result:

ok 50096 numbers

Test #18:

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

input:

39864
2
1 -1
4
1 1 -1 -1
1
1
1
-1
4
1 -1 1 1
3
-1 1 1
2
-1 1
1
1
4
-1 -1 1 1
1
-1
2
1 1
3
-1 1 -1
1
-1
1
-1
2
1 1
1
-1
4
-1 1 1 -1
1
-1
2
-1 -1
2
1 -1
2
-1 -1
1
1
4
-1 -1 -1 1
4
-1 -1 1 -1
1
1
3
-1 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
0
0
1
2
1
0
1
1
1
0
0
0
0
1
2
1
1
...

result:

ok 33241 numbers

Test #20:

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

input:

18285
8
-1 1 -1 -1 -1 1 -1 1
1
-1
5
1 -1 -1 1 1
8
-1 1 -1 -1 -1 1 -1 1
9
1 1 -1 1 -1 -1 -1 1 1
10
-1 1 1 -1 1 1 1 1 -1 -1
9
1 -1 1 1 1 -1 1 1 -1
9
-1 -1 -1 1 -1 -1 1 -1 1
8
1 1 1 -1 1 -1 -1 1
2
1 -1
8
-1 -1 1 -1 1 -1 -1 -1
5
-1 -1 -1 1 -1
9
-1 1 1 -1 -1 -1 -1 1 1
5
-1 -1 -1 -1 1
3
-1 -1 -1
9
-1 -1 -...

output:

3
0
1
3
2
3
4
2
1
0
2
1
2
2
1
4
1
1
1
1
1
1
2
0
2
2
3
1
2
0
1
2
5
1
0
0
3
2
1
1
1
1
2
1
2
4
0
0
2
1
1
1
1
0
2
3
2
1
2
2
2
1
0
3
1
0
1
3
2
1
3
3
2
2
1
1
0
1
0
1
1
2
1
2
2
4
0
0
3
1
1
3
1
0
1
1
1
0
0
2
0
2
2
3
1
3
2
1
0
0
3
1
3
0
1
1
1
2
1
2
1
0
2
1
1
4
1
2
1
1
1
2
3
3
3
3
2
3
0
0
3
1
3
4
0
0
4
0
3
1
...

result:

ok 18285 numbers

Test #21:

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

input:

18136
2
-1 1
8
-1 1 -1 1 1 1 1 1
3
-1 -1 -1
7
1 -1 1 -1 1 -1 1
8
1 -1 -1 -1 -1 1 -1 1
3
1 1 1
10
-1 -1 -1 1 1 -1 1 -1 -1 -1
5
1 -1 -1 -1 -1
10
-1 1 1 -1 1 -1 -1 -1 -1 1
5
1 -1 1 1 -1
4
-1 1 -1 -1
10
1 -1 1 -1 -1 1 1 1 1 -1
2
1 -1
8
1 -1 1 1 -1 1 1 -1
4
-1 1 1 1
7
-1 -1 -1 -1 -1 -1 -1
2
1 1
8
1 -1 1 ...

output:

0
2
1
2
1
1
2
1
1
1
1
1
0
1
1
3
1
0
1
0
1
1
0
1
1
2
1
3
0
1
2
1
0
0
1
2
1
2
1
0
2
1
1
2
1
2
1
1
1
2
0
3
1
0
0
0
2
1
0
0
1
0
2
1
2
0
1
1
0
1
2
1
0
0
0
2
0
2
1
0
1
1
0
2
1
0
0
2
2
1
0
0
0
0
1
1
0
1
1
2
2
0
0
1
0
1
2
0
0
1
1
0
0
0
1
0
1
1
1
0
4
2
0
1
1
0
0
0
1
1
0
1
0
0
2
0
1
1
0
0
0
1
1
0
2
1
1
0
2
1
...

result:

ok 18136 numbers

Test #22:

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

input:

18114
8
-1 1 1 -1 -1 -1 1 1
2
-1 1
8
-1 1 1 -1 -1 -1 -1 1
7
-1 1 1 -1 -1 1 -1
6
1 1 1 -1 -1 -1
9
1 -1 1 -1 -1 -1 -1 1 1
6
1 1 1 -1 1 -1
4
1 -1 1 1
1
-1
10
1 -1 -1 1 -1 1 1 -1 1 -1
3
-1 1 -1
2
1 -1
10
-1 -1 -1 1 -1 -1 1 1 -1 1
2
-1 1
1
1
1
1
1
-1
7
1 -1 -1 -1 -1 -1 -1
4
-1 1 -1 -1
9
1 1 -1 -1 1 -1 -1...

output:

2
0
1
2
2
1
1
1
0
0
0
0
3
0
0
0
0
2
1
4
0
3
1
1
2
2
2
2
0
0
1
1
0
2
1
0
0
2
0
1
0
2
0
0
0
1
0
0
0
0
0
1
0
1
2
0
1
2
0
1
0
0
1
0
0
0
2
2
3
2
0
0
1
1
1
1
1
0
2
2
0
0
1
0
1
1
1
0
0
2
1
2
0
1
0
1
1
1
0
1
1
0
2
0
1
2
2
3
0
0
0
0
3
1
1
1
0
0
3
2
0
2
0
0
1
0
0
2
1
0
0
0
0
1
0
2
2
0
0
0
3
2
0
3
0
2
1
2
0
1
...

result:

ok 18114 numbers

Test #23:

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

input:

18151
5
1 -1 -1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
2
3
6
0
3
3
3
7
4
3
2
3
1
1
5
1
6
1
2
1
5
7
4
4
1
6
6
6
7
4
1
3
2
5
2
6
4
6
2
2
4
6
5
2
4
7
5
6
6
5
5
1
7
7
6
1
5
1
1
3
5
2
3
0
1
3
5
1
2
3
5
2
2
7
7
3
1
2
2
4
3
0
5
3
6
0
7
2
6
5
3
0
1
1
0
1
5
7
2
2
5
0
4
5
2
...

result:

ok 9596 numbers

Test #25:

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

input:

9589
15
1 -1 -1 -1 -1 1 1 1 1 -1 -1 1 -1 1 1
11
1 -1 -1 1 -1 -1 1 1 -1 1 1
10
1 1 1 -1 1 -1 -1 1 -1 1
10
1 -1 1 -1 1 1 -1 1 1 -1
7
1 -1 1 -1 1 1 1
9
-1 -1 1 1 1 1 -1 1 -1
2
-1 1
13
1 -1 -1 1 1 -1 -1 1 -1 -1 1 -1 1
16
1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1
3
1 1 1
13
-1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -...

output:

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

result:

ok 9589 numbers

Test #26:

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

input:

9527
4
1 1 1 1
9
-1 -1 1 1 -1 1 -1 1 1
12
-1 -1 -1 -1 -1 -1 1 -1 1 1 -1 1
19
1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 1 -1 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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 9595 numbers

Test #28:

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

input:

100
42
1 -1 1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 1 -1 1 1 1 1
31
-1 1 1 1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1
35
1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 1 1 1 1 1
45
-1 -1 -1 -1 1 ...

output:

20
10
16
18
32
28
32
9
8
20
22
25
22
20
15
10
36
20
21
32
34
20
2
16
33
2
18
4
11
11
24
19
23
4
10
6
12
37
41
4
22
29
19
32
33
18
26
16
33
11
38
6
26
1
34
24
2
18
36
41
33
35
20
36
3
20
30
11
40
20
11
14
5
10
6
2
0
6
16
4
13
28
22
16
28
15
44
5
30
21
29
17
31
4
10
14
10
4
29
1

result:

ok 100 numbers

Test #29:

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

input:

100
34
-1 1 -1 1 -1 -1 1 1 -1 1 1 1 1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 -1 1 -1 -1 1
74
1 1 1 -1 1 1 1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1
54
1 1 -1 -1 -1 1 1 ...

output:

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

result:

ok 100 numbers

Test #30:

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

input:

100
46
1 1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 1
60
-1 1 1 1 1 1 -1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 1 1 1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 1 1 1 1 -1 1 -1 -1 1 1
40
1 1 -1 -1 -1 1 -1 1 1 -1...

output:

15
13
11
15
19
7
1
20
4
9
18
22
5
5
11
21
35
21
21
20
8
40
15
27
2
19
18
11
2
5
23
10
0
7
26
3
3
24
19
8
2
3
11
24
11
33
23
10
0
20
12
8
8
34
26
1
17
8
11
8
17
14
21
18
28
22
6
7
14
17
26
5
22
23
16
14
23
12
19
8
22
14
3
30
25
3
9
25
16
16
0
33
15
5
21
14
14
6
9
5

result:

ok 100 numbers

Test #31:

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

input:

100
55
-1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1
94
-1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #32:

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

input:

413
254
-1 1 -1 -1 1 1 1 1 1 -1 1 -1 1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 1 1 1 1 1 -1 -1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 1 1 -1 1 1 -1 -1 -1 -1 1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 1 -1 -1 1 1 1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 -1 1 -1 -1 -...

output:

120
174
202
184
52
70
186
44
191
164
4
140
53
180
199
91
118
41
157
176
193
185
209
116
59
83
201
67
38
32
133
133
220
165
30
47
84
146
219
97
228
145
19
86
115
47
54
26
62
54
1
219
144
2
18
56
88
90
110
129
112
64
72
7
120
19
17
119
0
209
86
1
89
106
150
41
17
80
34
72
81
178
20
30
41
17
154
10
107...

result:

ok 413 numbers

Test #33:

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

input:

400
43
1 1 -1 -1 -1 -1 -1 1 1 1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 -1 1 1
241
1 -1 1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 1 ...

output:

11
79
118
118
122
120
33
127
133
66
114
46
125
111
130
26
27
94
112
64
97
113
13
41
81
13
30
25
151
112
15
86
74
156
18
32
54
118
7
95
80
91
129
9
43
133
125
44
21
69
139
100
50
21
79
95
79
39
78
51
7
16
70
97
20
9
57
129
94
30
15
109
48
80
65
6
37
77
59
136
79
87
37
110
90
41
117
42
116
101
79
100
...

result:

ok 400 numbers

Test #34:

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

input:

395
2
1 -1
123
1 -1 -1 1 -1 1 1 1 1 -1 1 1 1 -1 -1 1 1 1 -1 -1 1 1 1 1 1 1 1 -1 -1 1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 -...

output:

0
34
111
126
136
33
80
127
111
52
136
83
105
156
74
39
72
0
82
101
21
133
31
123
143
30
133
115
2
104
9
104
17
119
25
139
21
98
55
2
97
86
130
51
40
76
89
17
29
90
37
78
89
131
102
20
57
87
55
93
80
9
103
133
91
77
77
14
10
9
132
72
151
6
104
96
26
35
107
80
57
153
157
37
67
11
130
70
97
45
100
56
1...

result:

ok 395 numbers

Test #35:

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

input:

415
156
1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1...

output:

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

result:

ok 415 numbers

Test #36:

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

input:

10
180
1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 ...

output:

0
0
0
0
0
0
0
0
0
0

result:

ok 10 numbers

Test #37:

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

input:

207
941
-1 1 1 1 1 1 1 -1 1 1 -1 -1 1 1 1 -1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 -1 1 1 1 1 1 -1 1 1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 ...

output:

441
409
147
227
67
208
47
76
176
376
150
296
51
359
206
47
5
2
18
397
86
290
329
342
223
291
0
96
221
180
169
97
6
155
385
135
356
77
100
108
89
141
297
60
149
439
117
426
346
74
258
167
272
201
222
264
364
114
387
313
187
17
438
33
221
112
451
80
377
456
369
26
81
357
208
264
157
142
214
13
28
393
...

result:

ok 207 numbers

Test #38:

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

input:

208
214
1 -1 -1 1 -1 1 1 1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 -1 1 1 -1 1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 1 1 -1 1 1 -1 1 -1 ...

output:

78
100
208
39
318
42
107
65
46
285
134
96
146
217
49
297
163
268
59
226
114
219
281
122
206
232
3
104
136
155
0
109
145
262
241
120
240
220
11
48
292
126
280
216
42
24
76
278
290
88
238
264
301
38
184
12
23
137
31
74
260
34
112
283
146
184
109
83
130
227
5
265
170
119
300
70
200
107
143
56
23
30
217...

result:

ok 208 numbers

Test #39:

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

input:

200
101
-1 1 -1 1 1 -1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 -1 -1 -1 -1 1 -1
296
1 -1 1 1 1 -1 -1 -1 -1 1 1 1 1 ...

output:

29
100
59
269
244
171
158
108
72
313
251
103
95
304
108
150
125
142
203
201
234
246
172
48
122
117
43
45
89
171
128
222
128
73
19
35
110
57
218
25
271
25
188
295
304
84
247
164
1
35
98
84
251
111
11
98
205
162
213
113
177
159
120
40
299
80
160
45
226
224
275
165
274
61
174
14
207
198
280
5
175
93
99...

result:

ok 200 numbers

Test #40:

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

input:

196
12
1 -1 1 -1 -1 1 -1 1 1 -1 -1 1
893
-1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1...

output:

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

result:

ok 196 numbers