Https://ide.codingblocks.com/s/237106

the code is giving wrong answer for two testcases please tell why??

hello @agarwalarjit.agarwal


summation of time taken can exceed the range of int so use long long .

still getting rong answer

a) bro u cannot sort the array because painter are allowed to paint only contiguous blocks.
so dont sort ur array.

b) intialise s with max_value_in_array * t

https://ide.codingblocks.com/s/237139 still getting wrong answer

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.

check ur updated code->

made changes that i suggested above

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.