HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Data Structures > problem:


Post Office Delivery

Volume problems

• 50842 - Minimum Sum Triangle - DP
• 50781 - ReversesreveR
• 50676 - Cinema Millennium
• 50780 - Hot Potato - Revisited
• 50678 - The Jumping Rabbit
• 50793 - Top M Customers
• 51073 - Campus Tours for High Sch...
• Check-Mate
• Post Office Delivery
• 50993 - Products in store
• 50564 - Mother's Milk Buckets
• 50593 - Transporter
• 50598 - Minimum Sum
• 50704 - Connected?
• 50705 - Student Clubs
• 50779 - The shortest path in a maze
• 180. 50776 - The number of differen...

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 Ibrahim Mesecan.

Post Office Package Delivery

The central post office has two service vehicles to deliver the mails. They need to deliver packages to the local neighborhood. But the vehicles have certain capacity and for safety reasons, they cannot take more that capacity. Since the packages cannot be taken partially, they need to choose some packages such that they can carry maximum total weight of packages using these vehicles. For example, if there are 5 packages with the weights: 5, 5, 7, 2 and 4; and if each vehicle can carry at most 10 kgs. It is better if the vehicles carry 5+5 and 7+2 and skip 4

Question: Write a program that is going to get the capacity of vehicles and weights of packages. And, print the maximum amount that can be distributed in one round.

Input specification
: First line contains three integers: The number of packages (n) and the total amount that each vehicle can carry (C1, C2). The following line contains n integers where 3 = n = 18; C1 and C2 are between 0 and 2,000; and weight of each packages is an integer between 0 and 200.

Output specification:
Show the maximum amount that can be distributed in one round.

Sample Input I
6 90 90
55 20 35 20 55 10
Sample Output I
175

Explanation for sample input 1:
for sample input 1: The two vehicles can carry totally 175 kgs (90 + 85). The first vehicle can take two packages (35 + 55). And the other can take the other three (55 + 20 + 10).



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

www.contester.ru