#Q77. 「一本通 3.2 练习 1」农场派对
「一本通 3.2 练习 1」农场派对
Description
Original source: USACO 2007 Feb. Silver
cows are going to attend a party held at the farm of cow numbered . There are directed roads, each with a length of . Every cow must attend the party and then return home, and each cow will choose the shortest path. Find the length of the longest shortest path (a round trip) among all cows. Special note: there may be multiple edges with different weights.
Input Format
Line : space-separated integers ;
Lines : space-separated integers , indicating a road from to with length .
Output Format
A single integer representing the length of the longest shortest path.
Sample 1
4 8 2
1 2 4
1 3 2
1 4 7
2 1 1
2 3 5
3 1 2
3 4 4
4 2 3
10