# TopCoder

Caido
$\mathbb{W}\mathcal{aimai}\sim$

94.3% (33/35)

37.4% (46/123)

# Input Format

$1 \leq N \leq 5 \times 10^ 5$
$0 \leq a_i \leq 10^ 9, \forall 1 \leq i < N, a_i < a_{i+1}$
$1 \leq Q \leq 5 \times 10^ 5$
$0 \leq S \leq 5 \times 10^ 5$

3
1 2 3
5
1
2
3
4
5

1
1
2
0
1

6
0 1 4 5 7 8
3
5
12
100

3
1
0

# Problem Source

No. Testdata Range Constraints Score
1 0~4 $N \leq 20, Q \leq 100, S \leq 100$ 10
2 5~14 $N \leq 2000$ 10
3 15~19 $Q \leq 5$ 10
4 20~24 $S \leq 2000$ 10
5 0~39 無其他限制 60

# Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 700 524288 65536 1 5
1 700 524288 65536 1 5
2 700 524288 65536 1 5
3 700 524288 65536 1 5
4 700 524288 65536 1 5
5 700 524288 65536 2 5
6 700 524288 65536 2 5
7 700 524288 65536 2 5
8 700 524288 65536 2 5
9 700 524288 65536 2 5
10 700 524288 65536 2 5
11 700 524288 65536 2 5
12 700 524288 65536 2 5
13 700 524288 65536 2 5
14 700 524288 65536 2 5
15 700 524288 65536 3 5
16 700 524288 65536 3 5
17 700 524288 65536 3 5
18 700 524288 65536 3 5
19 700 524288 65536 3 5
20 700 524288 65536 4 5
21 700 524288 65536 4 5
22 700 524288 65536 4 5
23 700 524288 65536 4 5
24 700 524288 65536 4 5
25 700 524288 65536 5
26 700 524288 65536 5
27 700 524288 65536 5
28 700 524288 65536 5
29 700 524288 65536 5
30 700 524288 65536 5
31 700 524288 65536 5
32 700 524288 65536 5
33 700 524288 65536 5
34 700 524288 65536 5
35 700 524288 65536 5
36 700 524288 65536 5
37 700 524288 65536 5
38 700 524288 65536 5
39 700 524288 65536 5