#P1629. 邮递员送信
邮递员送信
Description
There is a postman who needs to deliver items, and the post office is at node . He needs to deliver items, with destinations at nodes through . Because the city’s traffic is busy, all roads are one-way, with a total of roads. The postman can carry only one item at a time, and after delivering each item, he must return to the post office. Find the minimum time needed to deliver all items and finally return to the post office.
Input Format
The first line contains two integers, and , denoting the number of nodes and roads in the city.
From the second line to the -th line, each line contains three integers , indicating there is a one-way road from to with travel time .
Output Format
Output a single line containing one integer, the minimum required time.
5 10
2 3 5
1 5 5
3 5 6
1 2 8
1 3 8
5 3 4
4 1 8
4 5 3
3 5 6
5 4 2
83
Hint
Constraints:
- For of the testdata, .
- For of the testdata, , , , . The input guarantees that any two nodes can reach each other (the directed graph is strongly connected).
Translated by ChatGPT 5
京公网安备 11011102002149号