Question not clear

thenai and bi part is not clear

Hello @Gautampriyadarshi,

You are required to find cost of each of the cases:

  1. when he pay c1 for each ride he took in a rickshaw and cab
    i.e. c1*(total rikshaw + total cabs)

  2. When he pay c2 for each rikshaw type and each cab type
    i.e c2*(m+n)

  3. When he pays c3 for all rikshaws and for all cabs
    i.e. c3*(1+1)

  4. 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.

Hope, this would help.
Give a like if you are satisfied.

1 Like

so what is the input in the third line and fourth line

Hello @Gautampriyadarshi,

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.

Hope, this would help.
Give a like if you are satisfied.

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.