KILLHERO - Kill the enemy heroes

no tags 

You are about to face n enemies. You are given two arrays D and A. In the process of killing the ith enemy, your health decreases by D[i] and your armor decreases by A[i]. Initially you have H health and J armor. If your health becomes 0 or armor becomes 0, you die. You have to kill the maximum number of heroes without dying.

Find the maximum number of heroes you can kill while surviving.

 

Input:

The first line consists of an integer t, the number of test cases. For each test case, the first line consists of 3  integers n, H and J. The next line consists of n integers representing the array D. The next line consists of n integers representing the array A.


Output:

For each test case, find the maximum number of heroes you can kill.


Input Constraints:

1 <= t <= 50

1 <= n <= 50

1 <= H <= 500

1 <= J <= 500

0 <= D[i] <= 500

0 <= A[i] <= 500


Sample Input:

2

3 100 100

50 50 50

50 50 50

5 100 100

50 29 50 30 40

50 54 50 20 25


Sample Output:

1

3


hide comments
karthik1997: 2018-01-02 17:07:18

Really Good [spoiler] Question . Must try for beginners :) .

Last edit: 2018-08-22 16:21:25

Added by:cegprakash
Date:2015-01-06
Time limit:12s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: BF