Special Discounts

All submissions for this problem are available.
A Shopkeeper sells $N$ items. Each item costs same number of cents  $X$ cents and there are two types of discounts associated with each item $A[i]$ and $B[i]$ cents. Yash goes to the shop with $Y$ cents in his pocket. He can buy any number of items. Suppose he buys $K$ items with indices $i$_{$1$} $,$ $i$_{$2$} $.....$ $i$_{$K$}. Total discount on a set of items is equal to $min$ ($\sum_{j=1}^K$ $A$_{$i$$j$} $,$ $\sum_{j=1}^K$ $B$_{$i$$j$}). So for any subset of items he buys he will get the discount as mentioned above. Yash wants to buy maximum number of items. If there are more than one different sets of $K$ items that he can buy, then he will choose the set in which he has to spend least amount of cents. Suppose he spends $Z$ cents for buying maximum number of items. You have to minimize $Z$. He wants you to print two space separated integers, maximum number of items and minimum value of $Z$ in buying those maximum items. Please note that if he gets discount on a set of items which is more than cost of all items then he can take that set for free spending 0 cents. ###Input:  First line will contain $T$, number of testcases. Then the testcases follow.  Each testcase contains of a 3 lines of input.  First line of each test case contains 3 integers $N$ $,$ $X$ $,$ $Y$.  Second line contains $N$ integers of array $A$ .  Second line contains $N$ integers of array $B$ ###Output: For each testcase, output in a single line two space separated integers maximum number of items and minimum value of $Z$. ###Constraints  $1 \leq T \leq 5$  $1 \leq N \leq 100$  $0 \leq A[i] \leq 10$  $0 \leq B[i] \leq 10$  $1 \leq X \leq 10^3$  $1 \leq Y \leq 10^3$ ###Sample Input: 1 3 5 10 1 2 2 2 3 1 ###Sample Output: 3 10 ###EXPLANATION: Maximum number of items he can buy is 3 because 3 items cost 15 and buying all items will give him a discount of $min$ (1+2+2,2+3+1) $i.e$ 5. So with a discount of 5 and cost of 15 he can spend 155 cents and buy all those items. Since he needs to spend 10 cents we print 3 and 10.Author:  vishesh345 
Tags  vishesh345 
Date Added:  6012019 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions