#P4021. [CTSC2012] 最短路

    ID: 2952 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>2012WC/CTSC/集训队提交答案Special Judge

[CTSC2012] 最短路

Description

Given an undirected graph with positive edge weights in which node 11 and node NN are connected, delete at most KK edges so that nodes 11 and NN 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 N,M,KN, M, K. Here NN is the number of nodes, MM is the number of edges. Nodes are numbered from 11 to NN, and edges are numbered from 11 to MM in input order.
Then follow MM lines.
Each line contains three positive integers u,v,wu, v, w, indicating an edge between nodes uu and vv with weight ww.

Output Format

The first line of the output file shortest*.out contains a non-negative integer TT, the number of edges to delete.
Then output TT lines, each containing an integer xx between 11 and MM, indicating that the xx-th edge in the input is deleted. These TT 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 11 to 33 is 11. After deleting the third edge, the shortest path length becomes 22.

Scoring

For each test point, there are four scoring parameters s1,s2,s3,s4s_1, s_2, s_3, s_4. Let your solution’s shortest path be ans\textit{ans}.

  • If you produce no output, or the output is invalid, or the shortest path does not exist, you get 00 points.
  • If a shortest path exists, you get 11 point.
  • If anss1\textit{ans}\geq s_1, you get 33 points.
  • If anss2\textit{ans}\geq s_2, you get 55 points.
  • If anss3\textit{ans}\geq s_3, you get 88 points.
  • If ans=s4\textit{ans}=s_4, you get 1010 points.
  • If ans>s4\textit{ans}>s_4, you get 1212 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 NN is the test point index. For example, to test the 33-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