whats wrong in thec ode??
In spoj paratha problem
@sneha23
You had not taken input into the number of test cases because of which there was a TLE.
Use long long in place of int. Always a good practice to avoid overflow. Your logic for minPratha is wrong.
The array holds the rating, not the number of prathas made by a chef. Please refine your logic and revert back in case you face any difficulty.
sir pls explain whats the issue i m not able to find
@sneha23
Firstly, you are running the loop from 1 to n in the minparantha function. This is incorrect because the array is 0 indexed. Secondly, you are making a mistake in calculating the paranthas made. The value in a[i] is the rate, which means the time taken to make the first parantha, not the number of paranthas made in unit time.
For every chef, to calculate the number of paranthas made in time mid, solve the equation,
a[i](1 + 2 + … . . . p) <= mid, where p is the number of paranthas made by ith chef in mid time. Find p by solving this quadratic equation.
If my explanation was able to resolve your doubt, please mark the doubt as resolved.
Please revert in case you face any difficulty.