HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Data Structures > problem:


50677 - The Cottage

Guest
• Review clarifications (2)

Volume problems

• 50735 - Top M Products
• 50697 - Base Stations
• 50383 - Noisy Mornings
• 50479 - Bit Compressor
• 50674 - Collecting Eggs
• 50486 - Problems and Programmers
• 50695 - Longest link between neurons
• 50411 - Sum of the Leaves
• 50677 - The Cottage
• 50795 - Trunk
• 50414 - Traffic
• 50698 - Ayran Delivery
• 50978 - Albanian Coders
• 50699 - Fighting Vampires
• 50830 - Sorting BST Nodes
• 50803 - Sum of the depths in BST
• 50805 - Sum of the weights in a BST

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