#P3238. [HNOI2014] 道路堵塞

    ID: 2287 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>2014各省省选平衡树湖南最短路

[HNOI2014] 道路堵塞

Description

Country A has NN cities, numbered 11 to NN. There are MM directed roads between these NN cities, and the length of each road is a positive integer. The Ministry of Transport of Country A has designated a path from city 11 to city NN, and it is guaranteed that this path has the shortest length among all paths from city 11 to city NN. Unfortunately, as more and more people travel from city 11 to city NN, 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 11 to city NN would be if that road becomes impassable.

Input Format

The first line contains three space-separated positive integers NN, MM, and LL, denoting the number of cities, the number of directed roads, and how many roads are on the designated shortest path, respectively.
The next MM lines each contain three space-separated integers aa, bb, and cc, indicating there is a directed road from city aa to city bb with length cc. The line numbers of these MM lines are also the corresponding road IDs; that is, the 11-st of these lines corresponds to road ID 11, the 22-nd corresponds to road ID 22, ..., and the MM-th corresponds to road ID MM.
The last line contains LL space-separated integers sp(1),,sp(L)\operatorname{sp}(1), \ldots, \operatorname{sp}(L), which in order denote the IDs of the roads on the designated shortest path from city 11 to city NN.

Output Format

Output LL lines, each containing one integer. The integer on the ii-th line (i=1,2,,Li = 1, 2, \ldots, L) is the length of the shortest path from city 11 to city NN after removing the road with ID sp(i)\operatorname{sp}(i). If there is no path from city 11 to city NN after the removal, output 1-1.

4 5 2
1 2 2
1 3 2
3 4 4
3 2 1
2 4 3
1 5
6
6

Hint

100%100\% of the testdata satisfies 2<N<1000002 < N < 100000, 1<M<2000001 < M < 200000, c[0,10000]Zc \in [0, 10000] \cap \mathbb{Z}.

Testdata has been strengthened by Vfleaking.

Two sets of hack testdata were added on 2023-04-08.

Translated by ChatGPT 5