TopCoder

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

User's AC Ratio

90.5% (19/21)

Submission's AC Ratio

39.7% (25/63)

Tags

Description

Input Format

Output Format

Sample Input 1

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

Sample Output 1

3
11

Sample Input 2

8 7
2 1 1 4 7 3 5 4
2 2
1 8
1 9
2 1
1 7
2 2
1 6

Sample Output 2

15
9
14
22

Hints

Problem Source

110 學年度全國資訊學科能力競賽模擬賽

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資。 0
2 0~10 $N \le 5000, A_i \le 5000$ 8
3 0~1, 11~22 $A_i \le 10$ 21
4 23~31 $A_i$ 遞增 23
5 0~64 無額外限制 48

Testdata and Limits

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