Test cases not passing

Can you pls help me figure out why test cases aren’t passing in this question

hello @kunal81198 there were multiple mistakes in your code . i have corrected them .
if your deciding your range from a[n-1] to sum then you have to first sort your array onl then your largest elemnt will be at position a[n-1] or you when you are taking the mod then there you can find the maximum elemnt in your array i.e your starting point in the array .
you dint need to pass t you can multiply your anwer in the last .
and also your function in which you were checking was also wrong …
corrected code link https://ide.codingblocks.com/s/320058.
I hope i havecleared your doubt .
Happy Learning !!

Here isnt “t” the time a painter takes to paint 1 unit of board. So if there are boards like 10 , 20 ,30 ,40 and t=5 so if a single painter paints the boards then total time would be 10x5 +20x5+30x5 +40x5 so search space should be from 40x5 to the sum calculated above

yes @kunal81198 't" here is the time which painter takes to print one unit of board .
lets suppose we are calculating the answer for t=1 then also we have to minimise our time .
so that’s why if we find our answer by multiplying our answer with t or without and multiply afterwards it will give us the same answer .
I hope I have cleared your doubt !!

Happy Learning !!

No bro then why was my code wrong?

@kunal81198 i meant that you can do in that way also but you were not doing correct.
and when there is a much simple approach then why to comlplicate it unnecessarily.
i have only made coorection in code .
the major wrong part was you were not taking the correct range .
I hope you understood !!
Happy Learning !!

hey @kunal81198 if you feel that your doubt is cleared you can now mark this doubt as cleared .

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.