10306: CF EDU - DSU - Step 2 - H. Oil business
[Creator : ]
Description
You are given an undirected connected graph on $n$ vertices and $m$ edges. For each edge, you know the cost of deletion. You want to delete as many edges as possible so that the graph remains connected and the total cost of deleted edges does not exceed $s$.
Input
The first line of the input contains three integers $n, m, s\ (2 ≤n≤ 50 ,000,\ 1 ≤m≤ 100 ,000,\ 0 ≤s≤ 10^{18})$ — the number of vertices, the number of edges and the total provided cost, respectively.
Next $m$ lines contain a desc
Output
The first line of the output should contain the maximal number of deleted edges.
The second line should contain the indices of the deleted edges. The edges are indexed from one and respect the input order.
Sample 1 Input
6 7 10
1 2 3
1 3 3
2 3 3
3 4 1
4 5 5
5 6 4
4 6 5
Sample 1 Output
2
1 6