Not getting the correct answer

the code output is not correct , i am unable to rectify the error , the sample test case it is returning -1 instead of 12

hey @deepu.kumar2222 can you please explain the approach you used to solve this question.

@deepu.kumar2222 let me suggest you a better approach, which is easier to write and understand. Since each cook is independent, we will have each cook make the given number of pranthas and store the time taken by them to make 1 prantha, 2 prantha and so on in an vector and then we will sort vector and the answer would be the pth index in the sorted vector.

Code for reference purpose:

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.