Company: Buyhatke_30march
Difficulty: medium
Sam And Friends Problem Sam likes making sweets. He knows how to make n different types of sweet. Type i is described by two numbers: A[i] - the time it takes to make one sweet of that type. B[i] - the sweetness level of that type. Sam is a busy person, so he only has m days available. On day j he can devote at most C[j] time to making sweets. Rules: Sam can make each type of sweet at most once in total. Sam can make at most one sweet per day . A sweet of type i can be made on day j only if A[i] <= C[j] . Sam first wants to make as many sweets as possible . Among all the ways of making that many sweets, he wants the total sweetness of the sweets he makes to be as large as possible. Report both numbers. Input Format The first line contains the integer n , the number of sweet types. The next n lines each contain one integer: A[1] ... A[n] , one per line. The next line contains the integer n again. (inferred - the source repeats the count here; this second value is guaranteed to equal