Description

Input Format

Output Format

Sample Input 1

12
1 1 -1 1 1 1 -1 -1 1 -1 -1 -1
3
1 11
9 4
5 5

Sample Output 1

2
3
0

Sample Input 2

8
1 -1 1 1 -1 -1 1 -1
1
1 8

Sample Output 2

5

Hints

Problem Source

2022 網際網路程式設計全國大賽
高中組初賽

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 0~62 無額外限制 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 4000 1048576 65536 1 2
1 4000 1048576 65536 1 2
2 4000 1048576 65536 2
3 4000 1048576 65536 2
4 4000 1048576 65536 2
5 4000 1048576 65536 2
6 4000 1048576 65536 2
7 4000 1048576 65536 2
8 4000 1048576 65536 2
9 4000 1048576 65536 2
10 4000 1048576 65536 2
11 4000 1048576 65536 2
12 4000 1048576 65536 2
13 4000 1048576 65536 2
14 4000 1048576 65536 2
15 4000 1048576 65536 2
16 4000 1048576 65536 2
17 4000 1048576 65536 2
18 4000 1048576 65536 2
19 4000 1048576 65536 2
20 4000 1048576 65536 2
21 4000 1048576 65536 2
22 4000 1048576 65536 2
23 4000 1048576 65536 2
24 4000 1048576 65536 2
25 4000 1048576 65536 2
26 4000 1048576 65536 2
27 4000 1048576 65536 2
28 4000 1048576 65536 2
29 4000 1048576 65536 2
30 4000 1048576 65536 2
31 4000 1048576 65536 2
32 4000 1048576 65536 2
33 4000 1048576 65536 2
34 4000 1048576 65536 2
35 4000 1048576 65536 2
36 4000 1048576 65536 2
37 4000 1048576 65536 2
38 4000 1048576 65536 2
39 4000 1048576 65536 2
40 4000 1048576 65536 2
41 4000 1048576 65536 2
42 4000 1048576 65536 2
43 4000 1048576 65536 2
44 4000 1048576 65536 2
45 4000 1048576 65536 2
46 4000 1048576 65536 2
47 4000 1048576 65536 2
48 4000 1048576 65536 2
49 4000 1048576 65536 2
50 4000 1048576 65536 2
51 4000 1048576 65536 2
52 4000 1048576 65536 2
53 4000 1048576 65536 2
54 4000 1048576 65536 2
55 4000 1048576 65536 2
56 4000 1048576 65536 2
57 4000 1048576 65536 2
58 4000 1048576 65536 2
59 4000 1048576 65536 2
60 4000 1048576 65536 2
61 4000 1048576 65536 2
62 4000 1048576 65536 2