Toggle navigation
Bulletin
Problems
Submissions
Contests
Discuss
About
Rank
Sign in
Sign up
×
Close
2024 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2334 . E. 公路 (road)
Submit
Status
Discussion / Solution
Ranklist
Back to Problems List
TopCoder
AA 競程
AA 競程是最強的!
User's AC Ratio
84.2% (
16/19
)
Submission's AC Ratio
42.0% (
37
/
88
)
Tags
Show solution-related tags
TOI
TOI-pre
2023-TOI-pre
Description
題目 PDF 檔在這裡
Input Format
Output Format
Sample Input 1
copy
7 9
1 2 5
1 3 3
2 3 8
2 5 3
3 4 3
3 5 4
3 6 2
4 6 7
6 7 6
3
1 2
1 6
3 7
Sample Output 1
copy
5
7
-1
Hints
Problem Source
2023 TOI 初選
測資來源:
TWPCA GitHub
Subtasks
No.
Testdata Range
Constraints
Score
1
0
範例測資
0
2
1~10
$n \le 100,m,q, \le 300 ,l_i = 1$
18
3
0~21
$n \le 500,m,q \le 1000$
31
4
0~34
$m \le 3000$
22
5
0~49
無額外限制
29
Testdata and Limits
No.
Time Limit (ms)
Memory Limit (VSS, KiB)
Output Limit (KiB)
Subtasks
0
2000
1048576
65536
1
3
4
5
1
2000
1048576
65536
2
3
4
5
2
2000
1048576
65536
2
3
4
5
3
2000
1048576
65536
2
3
4
5
4
2000
1048576
65536
2
3
4
5
5
2000
1048576
65536
2
3
4
5
6
2000
1048576
65536
2
3
4
5
7
2000
1048576
65536
2
3
4
5
8
2000
1048576
65536
2
3
4
5
9
2000
1048576
65536
2
3
4
5
10
2000
1048576
65536
2
3
4
5
11
2000
1048576
65536
3
4
5
12
2000
1048576
65536
3
4
5
13
2000
1048576
65536
3
4
5
14
2000
1048576
65536
3
4
5
15
2000
1048576
65536
3
4
5
16
2000
1048576
65536
3
4
5
17
2000
1048576
65536
3
4
5
18
2000
1048576
65536
3
4
5
19
2000
1048576
65536
3
4
5
20
2000
1048576
65536
3
4
5
21
2000
1048576
65536
3
4
5
22
2000
1048576
65536
4
5
23
2000
1048576
65536
4
5
24
2000
1048576
65536
4
5
25
2000
1048576
65536
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
4
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
42
2000
1048576
65536
5
43
2000
1048576
65536
5
44
2000
1048576
65536
5
45
2000
1048576
65536
5
46
2000
1048576
65536
5
47
2000
1048576
65536
5
48
2000
1048576
65536
5
49
2000
1048576
65536
5
Submit
Back to Top