Toggle navigation
Bulletin
Problems
Submissions
Contests
Discuss
About
Rank
Sign in
Sign up
×
Close
NTUCPC Speed Run! #1
比賽已結束,感謝大家的參與!
題目連結
IOICamp 2025 PreExam 進行中!
IOICamp 官網
、
PreExam 連結
程式解題社網站
程式解題社網站
上線了!
291 . 保護費
Submit
Status
Discussion / Solution
Ranklist
Back to Problems List
TopCoder
Caido
主唱太拼命了
User's AC Ratio
78.6% (
11/14
)
Submission's AC Ratio
21.2% (
17
/
80
)
Tags
Show solution-related tags
ytp
ytp-senior
ytp-2023
Description
題目 PDF 檔在這裡
Input Format
Output Format
Sample Input 1
copy
5 4 3
1 2 1 2 3
1 2
2 3
3 4
4 5
1 3 3
Sample Output 1
copy
4
Hints
Problem Source
YTP 2023 高中組程式挑戰營 p8
Subtasks
No.
Testdata Range
Constraints
Score
1
0
範例測資
0
2
0~15
$K \leq 20$
5
3
0~42
無額外限制
15
Testdata and Limits
No.
Time Limit (ms)
Memory Limit (VSS, KiB)
Output Limit (KiB)
Subtasks
0
4000
524288
65536
1
2
3
1
4000
524288
65536
2
3
2
4000
524288
65536
2
3
3
4000
524288
65536
2
3
4
4000
524288
65536
2
3
5
4000
524288
65536
2
3
6
4000
524288
65536
2
3
7
4000
524288
65536
2
3
8
4000
524288
65536
2
3
9
4000
524288
65536
2
3
10
4000
524288
65536
2
3
11
4000
524288
65536
2
3
12
4000
524288
65536
2
3
13
4000
524288
65536
2
3
14
4000
524288
65536
2
3
15
4000
524288
65536
2
3
16
4000
524288
65536
3
17
4000
524288
65536
3
18
4000
524288
65536
3
19
4000
524288
65536
3
20
4000
524288
65536
3
21
4000
524288
65536
3
22
4000
524288
65536
3
23
4000
524288
65536
3
24
4000
524288
65536
3
25
4000
524288
65536
3
26
4000
524288
65536
3
27
4000
524288
65536
3
28
4000
524288
65536
3
29
4000
524288
65536
3
30
4000
524288
65536
3
31
4000
524288
65536
3
32
4000
524288
65536
3
33
4000
524288
65536
3
34
4000
524288
65536
3
35
4000
524288
65536
3
36
4000
524288
65536
3
37
4000
524288
65536
3
38
4000
524288
65536
3
39
4000
524288
65536
3
40
4000
524288
65536
3
41
4000
524288
65536
3
42
4000
524288
65536
3
Submit
Back to Top