Submit | All submissions | Best solutions | Back to list |
KILLHERO - Kill the enemy heroes |
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
Added by: | cegprakash |
Date: | 2015-01-06 |
Time limit: | 12s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: BF GOSU SCM qobi |
hide comments
2015-02-01 03:30:29 Scrooge McDuck
can u pls give some more test cases |
|
2015-01-31 16:39:19 cegprakash
Aadithya : If your health becomes 0 or armor becomes 0, you die |
|
2015-01-31 16:37:57 [[soup_boy]]
@Aadithya , you can kill 2 , 4 and 5. |
|
2015-01-31 16:35:12 Aadithya U
Y not the output is 2 for the first sample case ? |
|
2015-01-31 16:35:12 Aadithya U
Last edit: 2015-01-31 16:35:26 |