Please describe the output for 1st sample testcase.
Also I didn’t get 3rd and 4th line of input,as to what exactly does it says.
Please describe the output for 1st sample testcase.
Also I didn’t get 3rd and 4th line of input,as to what exactly does it says.
Hi Praveen,
Input format as discussed in the question:-
Each Test case has 4 lines which are as follows:
The first line contains four integers c1, c2, c3, c4 (1 ≤ c1, c2, c3, c4 ≤ 1000) — the costs of the tickets.
The second line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of rickshaws and cabs Ramu is going to use.
The third line contains n integers ai (0 ≤ ai ≤ 1000) — the number of times Ramu is going to use the rickshaw number i.
The fourth line contains m integers bi (0 ≤ bi ≤ 1000) — the number of times Ramu is going to use the cab number i.
Ouput format:-
For each testcase , print a single number - the minimum sum of rupees Ramu will have to spend on the tickets in a new line.
There are two test cases, therefore there are 2 outputs. Each of them is showing you the minimum sum of rupees that he will have to spend on the tickets.
If you have any other doubts, please feel free to ask again.
4th line of the first test case is 4 4 4
does this mean he is going to use cab no. a4 ,12 times?
For the first testcase ,
The total cost of rickshaws = min( min(2 * 1, 3) + min(5 * 1, 3), 7) = min(5, 7) = 5
The total cost of cabs = min( min(4 * 1, 3) + min(4 * 1, 3) + min(4 * 1, 3) , 7) = min ( 9, 7) = 7
Total final cost = min( totalCabCost + totalRickshawCost , c4) = min( 5 + 7, 19) = min ( 12, 19) = 12
We print 12.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.