TopCoder

Thumb vi punching
Caido
$\text{W}ai\text{M}ai\sim$

User's AC Ratio

96.9% (31/32)

Submission's AC Ratio

52.1% (38/73)

Description

Input Format

Output Format

Sample Input

// Sample input 1
8 2
4 2 2 1 3 3 0 1
1 2 3
2 3 1
3 4 2
5 6 2
6 7 3
6 8 1
2 6 3

// Sample input 2
4 3
1 10 0 1
1 4 3
3 2 2
4 2 1

Sample Output

// Sample output 1
21

// Sample output 2
16

Hints

Problem Source

2022 TOI 初選
測資來源:TWPCA GitHub

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資。 0
2 2~12 $n \le 100$ 10
3 13~22 自行車數量超過 $k$ 的租借站數量恰有一個 11
4 23~32 所有租借站位於一條直線上,如範例 2 17
5 33~42 無額外限制。 62

Testdata and Limits

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