#P4568. [JLOI2011] 飞行路线
[JLOI2011] 飞行路线
Description
Alice and Bob are going to travel by plane, and they chose a relatively cheap airline. This airline operates in cities, labeled to , and there are routes. Each route connects two cities and has a certain price.
Alice and Bob need to travel from one city to another along these routes, and they may transfer. The airline offers a discount for this trip: they can take flights on at most routes for free. What is the minimum total cost for their trip?
Input Format
The first line contains three integers , representing the number of cities, the number of routes, and the maximum number of free rides, respectively.
The next line contains two integers , representing the starting city and the destination city.
The next lines each contain three integers , indicating that there is a bidirectional route between cities and with price .
Output Format
Output a single integer on one line, which is the minimum total cost.
5 6 1
0 4
0 1 5
1 2 5
2 3 5
3 4 5
2 3 3
0 2 100
8
Hint
Constraints
For of the testdata, , , .
For of the testdata, , , .
For of the testdata, , , , , , .
There is also a set of hack testdata.
Translated by ChatGPT 5
京公网安备 11011102002149号