#P3238. [HNOI2014] 道路堵塞
[HNOI2014] 道路堵塞
Description
Country A has cities, numbered to . There are directed roads between these cities, and the length of each road is a positive integer. The Ministry of Transport of Country A has designated a path from city to city , and it is guaranteed that this path has the shortest length among all paths from city to city . Unfortunately, as more and more people travel from city to city , this designated path often gets congested. Now Country A wants to know, for each road on this path, what the shortest path length from city to city would be if that road becomes impassable.
Input Format
The first line contains three space-separated positive integers , , and , denoting the number of cities, the number of directed roads, and how many roads are on the designated shortest path, respectively.
The next lines each contain three space-separated integers , , and , indicating there is a directed road from city to city with length . The line numbers of these lines are also the corresponding road IDs; that is, the -st of these lines corresponds to road ID , the -nd corresponds to road ID , ..., and the -th corresponds to road ID .
The last line contains space-separated integers , which in order denote the IDs of the roads on the designated shortest path from city to city .
Output Format
Output lines, each containing one integer. The integer on the -th line () is the length of the shortest path from city to city after removing the road with ID . If there is no path from city to city after the removal, output .
4 5 2
1 2 2
1 3 2
3 4 4
3 2 1
2 4 3
1 5
6
6
Hint
of the testdata satisfies , , .
Testdata has been strengthened by Vfleaking.
Two sets of hack testdata were added on 2023-04-08.
Translated by ChatGPT 5
京公网安备 11011102002149号