# TopCoder

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

72.7% (16/22)

40.3% (52/129)

# Input Format

• $1\leq n\leq 2\times 10^ 5$
• $1\leq a_i\leq 10^ 9$（$1\leq i\leq n$）
• $1\leq l_i\leq r_i\leq n$（$1\leq i\leq n$）

4
7 1 2 2
1 3
3 3
2 3
1 4

6
7 2 2 7

# Problem Source

No. Testdata Range Constraints Score
1 0 範例測資 0
2 1~4 $l_i=1,r_i=i$ 7
3 1, 5~8 $n\leq 3000,r_i\leq i$ 8
4 1~14, 19 $r_i\leq i$ 22
5 1, 15~22 $l_i=r_i$ 21
6 0~1, 15~26 $\sum\limits_{i=1}^ n(r_i-l_i+1)\leq 5\times 10^ 5$ 16
7 0~45 無其他限制 26

# Testdata and Limits

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