LemonMonster's blog

By LemonMonster, history, 4 years ago, In English

Hello Everybody , Recently I was learning Binary Search and tried to to solve thsi problem using it. -- Link to the problem. My solution is like the one given in step 2 of binary search in codeforces edu by pashka
I have a good function to check if the people are enough to reach the desired place. in the beginning the l is 0 and the r is 1. then I continue multiplying r by 2 unless i reach a solution (r is definitely true ) then I binary search for the answer. But my program gives time limit exceeded.

My full solution



Only the good function



The mian function



  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?