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

9869번 - Milk Scheduling 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB60226621946.105%

문제

Farmer John has N cows that need to be milked (1 <= N <= 10,000), each of which takes only one unit of time to milk.

Being impatient animals, some cows will refuse to be milked if Farmer John waits too long to milk them. More specifically, cow i produces g_i gallons of milk (1 <= g_i <= 1000), but only if she is milked before a deadline at time d_i (1 <= d_i <= 10,000). Time starts at t=0, so at most x total cows can be milked prior to a deadline at time t=x.

Please help Farmer John determine the maximum amount of milk that he can obtain if he milks the cows optimally.

입력

  • Line 1: The value of N.
  • Lines 2..1+N: Line i+1 contains the integers g_i and d_i.

출력

  • Line 1: The maximum number of gallons of milk Farmer John can obtain.

제한

예제 입력 1

4
10 3
7 5
8 1
2 1

예제 출력 1

25

힌트

Input Details

There are 4 cows. The first produces 10 gallons of milk if milked by time 3, and so on.

Output Details

Farmer John milks cow 3 first, giving up on cow 4 since she cannot be milked by her deadline due to the conflict with cow 3. Farmer John then milks cows 1 and 2.

출처

Olympiad > USA Computing Olympiad > 2013-2014 Season > USACO December 2013 Contest > Silver 1번

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

출처

대학교 대회

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

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