pls explain the question and approach to its solution
Not able to understand the question
You are required to find cost of each of the cases:
when he pay c1 for each ride he took in a rickshaw and cab
i.e. c1*(total rikshaw + total cabs)
When he pay c2 for each rikshaw type and each cab type
i.e c2*(m+n)
When he pays c3 for all rikshaws and for all cabs
i.e. c3*(1+1)
When he pays only c4 for all rickshaws and cabs
i.e. c4
You have to consider the combinations also.
example: if c1 is 1 and c2 is 5,
then you should pay c1 for rickshaw or cab rides less than 5.
and for rides greater or equal to 5, paying c2 is feasible.
The aim is to pay minimum.
The second line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of rickshaws and cabs Ramu is going to use.
So, third line contains n integers:
each ith integer specifies the number of rides he took in the ith rickshaw.
Similarly, the fourth line contains m integers:
each ith integer specifies the number of rides he took in the ith rab.
Example:
1
1 3 7 19
2 3
2 5
4 4 4
He would take 2 different rickshaws and 3 different cabs.
He would then take 2 rides in the first rickshaw and the 5 rides in the second.
Similarly, he would take 4 rides in each cab.
You can also watch Prateek bhaiyas video on this problem: https://www.youtube.com/watch?v=CKDFPzX24BY
https://ide.codingblocks.com/s/258044 corrected code. I have mentioned the line at which there was error. You had used a[i] instead of b[i]