#P10758. [CTSC2011] 道路监控

    ID: 12240 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>2011提交答案Special JudgeCTSC/CTS

[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 G=(V,E)G=(V, E), where VV is the set of nodes in the road network, and EE is the set of bidirectional roads connecting the nodes. All nodes are numbered from 11 to nn, where nn is the number of nodes. City A is located at node ss, and City B is located at node tt.

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 ss to node tt 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 ss to tt 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 ee, the installation cost is W(e)W(e). Since the budget is limited, they want to find a plan such that the response difficulty of the road network does not exceed kk. Please help them find a deployment plan that is as economical as possible.

Input Format

This is an output-only problem. There are 1010 input files road*.in in your directory.

The first line of each input file contains three integers nn, mm, and kk, representing the number of nodes, the number of roads, and the upper limit of the response difficulty.

The second line contains two integers ss and tt, representing the node indices of City A and City B.

The next mm lines each contain three positive integers aia_i, bib_i, and wiw_i, describing a road connecting node aia_i and node bib_i, with an installation cost of wiw_i 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 ss, indicating that in the contestant’s plan, monitoring devices will be installed on ss roads. The next ss lines each contain an integer pip_i, indicating that a monitoring device is installed on the pip_i-th road in the input file (edges are numbered starting from 11).

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 00 points.

For each test case, we have five scoring parameters m1m_1, m2m_2, m3m_3, m4m_4, and m5m_5. Suppose the total cost of the contestant’s plan is cc.

  • If c<m1c<m_1, you get 1212 points. (Note: in the actual contest, this was 1010 points.)
  • If c=m1c=m_1, you get 1010 points.
  • If m1<cm2m_1<c\leq m_2, you get 88 points.
  • If m2<cm3m_2<c\leq m_3, you get 55 points.
  • If m3<cm4m_3<c\leq m_4, you get 33 points.
  • If c<m5c<m_5, you get 11 point.
  • Otherwise, you get 00 points.

Translated by ChatGPT 5