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

26994번 - Cleaning Shifts 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB20121157.895%

문제

Farmer John's cows, pampered since birth, have reached new heights of fastidiousness. They now require their barn to be immaculate. Farmer John, the most obliging of farmers, has no choice but hire some of the cows to clean the barn.

Farmer John has N (1 ≤ N ≤ 10,000) cows who are willing to do some cleaning. Because dust falls continuously, the cows require that the farm be continuously cleaned during the workday, which runs from second number M to second number E during the day (0 ≤ M ≤ E ≤ 86,399). Note that the total number of seconds during which cleaning is to take place is E-M+1. During any given second M..E, at least one cow must be cleaning.

Each cow has submitted a job application indicating her willingness to work during a certain interval T1..T2 (where M ≤ T1 ≤ T2 ≤ E) for a certain salary of S (where 0 ≤ S ≤ 500,000). Note that a cow who indicated the interval 10..20 would work for 11 seconds, not 10. Farmer John must either accept or reject each individual application; he may NOT ask a cow to work only a fraction of the time it indicated and receive a corresponding fraction of the salary.

Find a schedule in which every second of the workday is covered by at least one cow and which minimizes the total salary that goes to the cows.

입력

  • Line 1: Three space-separated integers: N, M, and E.
  • Lines 2..N+1: Line i+1 describes cow i's schedule with three space-separated integers: T1, T2, and S.

출력

  • Line 1: a single integer that is either the minimum total salary to get the barn cleaned or else -1 if it is impossible to clean the barn.

제한

예제 입력 1

3 0 4
0 2 3
3 4 2
0 0 1

예제 출력 1

5

힌트

출처

Olympiad > USA Computing Olympiad > 2005-2006 Season > USACO December 2005 Contest > Silver ?번

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

출처

대학교 대회

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

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