문제
Problem 1: Milk Scheduling [Traditional, 2011]
Farmer John has N cows that need to be milked
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
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
출력
* Line 1: The maximum number of gallons of milk Farmer John can obtain.
예제1
4
10 3
7 5
8 1
2 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.