| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 44 | 11 | 10 | 23.810% |
Everybody knows that Romanian construction workers are very lazy. One of these workers is Dorel, who works for a company that builds roads across the country. Yesterday he received his new task: he is given N Romanian cities across the country (labeled from 1 to N), and M two-way roads (labeled from 1 to M) which are not yet built, each connecting exactly two cities; out of these roads he has to select and build N-1 so that all the cities become connected. Unfortunately the problem is not so simple for Dorel: each road i has two associated costs: C1i - the effort to build the road and C2i - the profit obtained per unit of effort spent for building the road. C1i * C2i is the profit of building the road. Of course Dorel wants to work as little as possible so the most important thing is that the effort of building all the roads must be minimum; if there are more ways of building roads so that the total effort is minimum, Dorel wants the total profit (the sum of profits for each road) to be maximum.
You have to solve Dorel's problem!
On the first line of the standard input there are two numbers N and M, the number of cities and the number of roads. Next are M lines, the i-th of these lines has 4 natural numbers: ai and bi representing the cities road i connects, C1i and C2i.
You must print to the standard output must contain N-1 lines representing the indexes (according to the input) of the roads which should be chosen by Dorel.
3 3 1 2 1 7 2 3 3 2 1 3 2 3
1 3