#P2685. [TJOI2012] 桥
[TJOI2012] 桥
Description
There are islands and bridges. Each bridge connects two islands. There are some enemies on every bridge; the player can pass a bridge only after defeating the enemies on it, and doing so inflicts some damage to the player. There is also a big Boss guarding exactly one bridge, which is impassable for the player given their current ability. The Boss is evil and will choose a bridge to guard so that, after blocking that bridge, the minimum possible total damage the player must suffer to travel from island to island (of course the player will choose the path with the least damage) is as large as possible. Determine which bridges the Boss might guard.
Note: multiple edges and self-loops are allowed.
Input Format
The first line contains two integers .
The next lines each contain three integers , indicating that the enemies on the bridge connecting islands and will inflict damage on the player.
Output Format
One line with two integers , where is the minimum damage the player must suffer in the presence of the Boss, and is the number of bridges that the Boss might guard.
3 4
1 2 1
1 2 2
2 3 1
2 3 2
3 2
Hint
- For of the testdata, .
- For of the testdata, , , .
- It is guaranteed that the player can reach island from island .
Translated by ChatGPT 5
京公网安备 11011102002149号