Doubt about what's wrong in my code for PRATA problem discussed in binary search( divide and conquer section)

it"s showing time limit exceeded

@kohliaaru09
There are few mistakes in your code. I am pointing out them

  1. line no. 10 should be while((sum+(a[j]*i))<=mid){
  2. Make sum=0 inside j loop. You should have start with sum=0 for each cook.
  3. Remove j++ in line 15
  4. Also increase the size of a[] array to a[50]. Number of cook can be upto 50.

@kohliaaru09
Here is the updated code, please check here: https://ide.codingblocks.com/s/258450

1 Like

@kohliaaru09
Please mark this doubt as resolved if you don’t have any other doubt regarding this question.