Painter Problem Explaination

Can anyone tell what should be output for test case
5
2
5
1 10 40 40 50

answer will come out to be 450

can you please elaborate how?

Ok now i understand the ques but the problem is i am not able to find what is wrong with my approach.Can you please tell the test cases I am failing.

Ya sure, let me check your code and let u know the mistakes…

Harshit, I have made few corrections in your code, These are the corrections I have made,

  1. I have made 2 separate functions, one which you have written inside the main only, for the search space so as to enhance the clarity of code…
  2. Instead of using bool feasible function, I have used an integer function with somewht similar logic wht you have used in your code.
    3, In the minimum time function which I have created, the value of s= maximum(ar,n) whereas the e=total, i.e the sum of all the array elements…
  3. I have used array instead of vector in the code…

You can refer to the code, if you didnt understood anything , pls let me know…

Yes i understood what you did. Maybe when i multipleed with t it got out of ll range

Yes, pls mark your doubt as resolved if you were clear with the question…