#P10525. [XJTUPC 2024] 图上操作
[XJTUPC 2024] 图上操作
Problem Description
You are given a directed graph with vertices and edges, where the vertices are numbered from to . Each edge has a positive integer weight . In particular, .
Now define the bottleneck path value of vertex as follows: among all directed paths from vertex to vertex , take the minimum edge weight on each path, and then take the maximum of these minimum values. In particular, if is not reachable from , then its bottleneck path value is .
There are modifications. Each modification specifies an edge and decreases its weight, and it is guaranteed that the weight is still a positive integer after the decrease.
After each modification, output the bottleneck path values of vertices . Note that each modification is applied on top of all previous modifications; they are not independent.
Since the output is too large, let the bottleneck path value of vertex after a modification be . You only need to output after each modification.
Input Format
The first line contains three positive integers (,,), separated by spaces, with the meanings as described above.
The next lines each contain three positive integers (,,), separated by spaces, indicating that there is a directed edge from to with weight . The index of this edge is . It is guaranteed that there are no self-loops, but there may be multiple edges.
The next lines each contain two positive integers (,), separated by spaces, indicating that the weight of edge is decreased by , and it is guaranteed that the resulting weight is greater than .
Output Format
Output lines, each containing one non-negative integer, which is the answer you computed.
3 3 4
1 2 3
2 3 4
1 3 5
3 1
3 2
1 2
2 3
44
36
20
20
Hint
After the first modification, the bottleneck path value of vertex is , and the bottleneck path value of vertex is .
After the second modification, the bottleneck path value of vertex is , and the bottleneck path value of vertex is .
After the third modification, the bottleneck path value of vertex is , and the bottleneck path value of vertex is .
After the fourth modification, the bottleneck path value of vertex is , and the bottleneck path value of vertex is .
Translated by ChatGPT 5