#P4172. [WC2006] 水管局长
[WC2006] 水管局长
Description
Each day, the water supply company may need to deliver a certain amount of water from to . Dudu must find a path of pipes from to for the company. Then, through an information control center, he instructs the pipes on the path to enter a ready-to-deliver state. Once every pipe on the path is ready, the company can start delivering water. Dudu can handle only one delivery task at a time; he can process the next task only after the current delivery is completed.
Before each delivery task, every pipe on the chosen path must undergo a series of preparation operations, such as cleaning and disinfection. At Dudu’s command, these preparations start simultaneously on all pipes of the path. However, due to differences in length and inner diameter, the required preparation time may vary from pipe to pipe.
The water supply company always hopes Dudu can find a delivery path such that the time until all pipes on the path are ready is as short as possible. Dudu wants you to help him build a system that selects such a path to meet the company’s requirement. In addition, since the water pipes in MY City are old, some pipes may occasionally fail and become unusable; your program must take this into account.
We model the water pipe network of MY City as a simple undirected graph (i.e., without self-loops or multiple edges): pipes are edges, and junctions are nodes. The entire graph has nodes and edges, with nodes numbered from to .
Input Format
The first line contains three integers, representing the number of junctions (nodes) , the current number of pipes (undirected edges) , and the number of tasks your program needs to process (including both finding a path that meets the requirement and accepting that some pipe has broken) .
Each of the next lines contains three integers , indicating there is a pipe connecting with preparation time .
Each of the next lines contains three integers , describing a task. Here indicates the task type:
- If , you need to find a path of pipes from to that meets the requirement, i.e., the preparation time is minimized.
- If , it means the pipe directly connecting and is declared scrapped.
Output Format
For each task with , output a single integer on one line indicating the answer.
4 4 3
1 2 2
2 3 3
3 4 2
1 4 2
1 1 4
2 1 4
1 1 4
2
3
Hint
Constraints
For all test points, it is guaranteed that:
- , .
- , , .
- The given graph has no multiple edges and no self-loops. Before a pipe is declared scrapped, it is guaranteed that the pipe exists in the graph and has not been scrapped.
- The number of scrapped pipes does not exceed , and at any time the graph is guaranteed to remain connected.
Translated by ChatGPT 5
京公网安备 11011102002149号