#P4021. [CTSC2012] 最短路
[CTSC2012] 最短路
Description
Given an undirected graph with positive edge weights in which node and node are connected, delete at most edges so that nodes and remain connected, while making the shortest path between them as long as possible.
Input Format
This is an output-only problem. Please download the input files from the link: input files (shortest1.in ~ shortest10.in).
The first line of the input file shortest*.in contains three positive integers . Here is the number of nodes, is the number of edges. Nodes are numbered from to , and edges are numbered from to in input order.
Then follow lines.
Each line contains three positive integers , indicating an edge between nodes and with weight .
Output Format
The first line of the output file shortest*.out contains a non-negative integer , the number of edges to delete.
Then output lines, each containing an integer between and , indicating that the -th edge in the input is deleted. These integers must be pairwise distinct.
3 3 1
1 2 1
2 3 1
1 3 1
1
3
Hint
Sample Explanation
In the sample, the shortest path length from node to is . After deleting the third edge, the shortest path length becomes .
Scoring
For each test point, there are four scoring parameters . Let your solution’s shortest path be .
- If you produce no output, or the output is invalid, or the shortest path does not exist, you get points.
- If a shortest path exists, you get point.
- If , you get points.
- If , you get points.
- If , you get points.
- If , you get points.
- If , you get points.
Your score for a test point is the maximum among the applicable cases above.
How to Test Your Output
First, compile checker.cpp.
There will be a program named checker in your directory that can be used to verify your output. You can run the following command in the terminal:
./checker N
Here is the test point index. For example, to test the -rd test point:
./checker 3
This program checks whether your output solution is valid. If it is valid, it will also report the length of the shortest path.
Special Notes
Please keep your input files and output files properly saved and back them up in time to avoid accidental deletion.
Translated by ChatGPT 5
京公网安备 11011102002149号