시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB61493794.872%

문제

Rupert makes a living as the only real estate agent in a small town in England. He asks for 5% commission for every house that he sells.

Rupert organises one big auction per year. Every family (numbered from 1 to n) must participate in this action, although making or an accepting an offer is optional. Everyone puts in bids for the houses they would like to move to, provided they can sell their current house at the same time.

This is a very transparent process–Rupert can see exactly how much commission he will make if he accepts the right buyers’ offers on behalf of the sellers. He may discard some offers from buyers in order to drive up the overall commission. In fact, he might even decide to discard all of the offers from one family and let them stay in their current home, if it makes more money for him.

Find the maximum commission Rupert can make if he discards offers optimally.

입력

The input consists of:

  • one line containing two integers n and m (1 ≤ n ≤ 150, 0 ≤ m ≤ n × (n − 1)), the number of families on the market and the number of offers made.
  • m lines, describing the offers. The ith such line contains three integers fi, hi and ai (1 ≤ fi, hi ≤ n, fi ≠ hi, 0 ≤ ai ≤ 106), the family making the offer, the family that owns the house that the offer is for and the amount offered. No family makes more than one offer to the same house.

출력

Output how much Rupert will earn via commissions if he discards offers optimally. Your answer must be accurate to an absolute or relative error of 10−6.

예제 입력 1

4 5
1 2 3
2 3 9
3 1 5
3 2 11
4 1 6

예제 출력 1

1.0

예제 입력 2

4 5
1 2 15
2 3 9
3 1 5
3 2 11
4 1 6

예제 출력 2

1.45

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2019 E번

  • 문제를 만든 사람: Bjarki Ágúst Guðmundsson