#P10758. [CTSC2011] 道路监控
[CTSC2011] 道路监控
Problem Description
The road safety department recently plans to deploy a road monitoring system from City A to City B, to improve its ability to respond to emergencies. The road network from City A to City B can be described as an undirected graph , where is the set of nodes in the road network, and is the set of bidirectional roads connecting the nodes. All nodes are numbered from to , where is the number of nodes. City A is located at node , and City B is located at node .
The department plans to install monitoring devices on some roads, in order to reduce the overall response difficulty of the road network. When an emergency happens, the department needs to assign personnel to be on duty on some roads, so that any path from node to node passes through at least one monitored road (a road with a monitoring device installed, or a road with personnel on duty). Therefore, the response difficulty is defined as the minimum number of roads that need personnel to be assigned, so that any path from to passes through at least one monitored road.
Due to different natural environments, the cost of installing monitoring devices on different roads may also differ. Specifically, for an edge , the installation cost is . Since the budget is limited, they want to find a plan such that the response difficulty of the road network does not exceed . Please help them find a deployment plan that is as economical as possible.
Input Format
This is an output-only problem. There are input files road*.in in your directory.
The first line of each input file contains three integers , , and , representing the number of nodes, the number of roads, and the upper limit of the response difficulty.
The second line contains two integers and , representing the node indices of City A and City B.
The next lines each contain three positive integers , , and , describing a road connecting node and node , with an installation cost of for the monitoring device.
Output Format
For each input file, provide the corresponding output file road*.out in the directory.
The first line of the output file contains a value , indicating that in the contestant’s plan, monitoring devices will be installed on roads. The next lines each contain an integer , indicating that a monitoring device is installed on the -th road in the input file (edges are numbered starting from ).
3 3 1
1 3
1 2 1
2 3 10
1 3 5
1
1
Hint
For each test case, if you do not output anything or your output is invalid, you will get points.
For each test case, we have five scoring parameters , , , , and . Suppose the total cost of the contestant’s plan is .
- If , you get points. (Note: in the actual contest, this was points.)
- If , you get points.
- If , you get points.
- If , you get points.
- If , you get points.
- If , you get point.
- Otherwise, you get points.
Translated by ChatGPT 5