HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Dynamic programming & Greedy > problem:


50677 - The Cottage

Guest
• Review clarifications (2)

Section problems

• 50672 - Math and Soldiers
• 50671 - Phalanx
• 50842 - Minimum Sum Triangle - DP
• 50676 - Cinema Millennium
• 50678 - The Jumping Rabbit
• 51149 - One Piece Arena
• 50485 - Center of gravity of a plate
• 50674 - Collecting Eggs
• 50677 - The Cottage
• 50675 - Kruja Boys
• 50679 - Jetpack Hurdle Jumping
• 50673 - DNA Testing
• 50997 - Dynamic Knights
• 50936 - Saving the Soldiers
• 50979 - Minimum access cost for BST
• 51062 - Fish Pond II
• 51010 - Max Sequential Sum

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Osman Ay.

The Cottage

Question:
Residents of Ankara go to the mountains in the sweltering days of summer. Mr. Moneysayar has a cottage at the mountains of Ankara. He rents his cottage to make money. The rental fee of the cottage is depending of the number of the rental days; ₺100 per day. Mr. Moneysayar has a list of the requests (starting and ending days) for the next twelve months. Make a program that calculates maximum amount of money Mr. Moneysayar can make for the next twelve months.

Input specification
The first line of the input contains a single integer N (1 ≤ N ≤ 1000) that is the number of the requests. Each of the following N lines denotes a request with two integers: a and b (0 ≤ a < b < 365) where, a is the starting day and b is the ending day and start and end days are included in the rent. One customer can check in the cottage only after the ending day of the previous customer.

Output specification
The output contains a single integer that is the maximum money that Mr. Moneysayar can make.

 Sample Input I     Sample Output I   
 5
 5 6
 1 3
 4 7
 7 9
 2 5
 800

Output specification
If the days 1-3, 5-6, and 7-9 are taken it makes ₺800


Для отправки решений необходимо выполнить вход.

www.contester.ru