| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 50 | 15 | 11 | 28.947% |
Justas built a passenger airplane, and now he wants to start a low cost airline, called Justas Airlines.
Justas made a list of the N most popular cities among tourists, and calculated which routes between these cities would be profitable. Each route connects two cities. The profitability of the route indicates how many Euros per month Justas Airlines would earn by operating the route.
Routes have to be chosen so that any two routes have one city in common. Calculate the maximum profit that Justas Airlines can make in one month.
The first line shows the number of cities N, and the number of profitable routes M. Cities are labeled 1 to N. The following M lines contain three numbers each – ai, bi, and pi, where ai and bi are the two cities joined by the i-th routes, and pi is the profitability of the route. No two routes connect the same pair of cities.
Output a single number: the maximum possible profit.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 12 | N ≤ 200 |
| 2 | 25 | N ≤ 5000 |
| 3 | 16 | pi = 1 for all i |
| 4 | 47 | No additional constraints |
5 4 1 2 1 1 3 2 1 4 1 2 4 1
4
Picking routes 1–2, 1–3, 1–4 would give a profit of 4 euros per month and this is the correct answer. One can select routes 1–2, 1–4, 2–4 as well, but profit would then be smaller – 3.
7 9 1 2 2 2 3 5 2 4 3 2 5 5 2 6 4 4 5 8 4 7 6 5 6 2 5 7 6
21
7 8 1 2 10 1 4 3 2 3 20 2 4 8 3 4 12 4 5 1 4 6 2 4 7 3
40
Olympiad > Lithuanian Olympiad in Informatics > Lithuanian Olympiad in Informatics 2017/2018 > National Round (2) > 10-12 Classes ?번