TopCoder

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

User's AC Ratio

67.5% (27/40)

Submission's AC Ratio

24.1% (70/291)

Tags

Description

Input Format

Output Format

Sample Input 1

8 8
6 8
3 6
2 6
1 3
1 2
1 4
1 5
5 7
-1 2 3 -10 -3 0 4 2

Sample Output 1

6

Sample Input 2

2 1
1 2
-1 -10

Sample Output 2

-1

Hints

Problem Source

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 2~12 $n \le 100$ 17
3 1, 3~8, 13~25 $m = n − 1$ 23
4 22~33 $a_i \ge 0$ 34
5 0~41 無額外限制 26

Testdata and Limits

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