Tommy bought gifts for his
Tommy bought
He wants to make as many perfect bundles as possible! A perfect bundle is one in which there is exactly one Christmas gift, one New Year's gift,
Unfortunately, it might not be possible to give all his friends perfect bundles. Can you figure out how many of his friends can get perfect bundles?
Input Specification
The first line contains three integers, separated by a single space:
The next line of input contains
The last line of input contains
It is guaranteed that all
The following table shows how the available 15 marks are distributed.
Mark Awarded | Number of Gifts | Total Price | Additional Constraints |
---|---|---|---|
None | |||
None |
Output Specification
Output a single integer, the maximum number of perfect bundles.
Sample Input 1
5 2 8
1 2 3 4 5
6 5 7 4 2
Output for Sample Input 1
1
Explanation of Output for Sample Input 1
The only possible perfect bundle he can make is
Sample Input 2
5 1 8
1 3 5 6 2
3 2 6 5 7
Output for Sample Input 2
5
Explanation of Output for Sample Input 2
He can make five perfect bundles:
Comments
For anyone using python, using lists will most probably TLE.