Logo
(追記) (追記ここまで)

17798번 - Estate Agent 스페셜 저지다국어

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

문제

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
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /