TopCoder

User's AC Ratio

68.4% (13/19)

Submission's AC Ratio

38.5% (20/52)

Tags

Description

Input Format

Output Format

Sample Input 1

50 3
20 50 5
35 50 2
1 30 3

Sample Output 1

142

Sample Input 2

50 3
20 40 5
45 50 2
1 30 3

Sample Output 2

-1

Sample Input 3

50 7
45 50 5
32 48 7
23 40 6
1 28 10
10 35 8
37 50 12
1 13 5

Sample Output 3

302

Hints

Problem Source

YTP 2024 國中組程式挑戰營 p4

Subtasks

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 0~12 $1 \leq H \leq 10^ 5, 1 \leq N \leq 10^ 3$ 3
3 0~22 $1 \leq H \leq 3 \times 10^ 5, 1 \leq N \leq 3 \times 10^ 5$ 3
4 0~32 無額外限制 9

Testdata and Limits

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