I have attempted the question, can u please provide the solution so that i can check my mistake?
Can i get the solution of this question
you can refer this
please tell the error in my code
This part is wrong, check the while loop part in the code i have attached below
int count = 0;
int chef = 0;
int time = 0;
for(int i = 1; i <= n; i++)
{
if(time + (c[chef] * i) > m and chef <= n)
{
chef ++;
if(count == p)
{
return true;
}
}
else
{
time += c[chef] * i;
count ++;
}
}
can u explain the min_time function in ur code, i am unable to get it
what i am doing in my min_time function is , to check if in given time(mid) can you cook the paratas. if yes return true;else false.
Also
(x*(x+1)*a[i]<=2*mid)
is to handle this case that, A cook with a rank R can cook 1 prata in the first R minutes 1 more prata in the next 2R minutes, 1 more prata in 3R minutes and so on(he can only cook a complete prata)
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.