New binary search method
Difference between ru1 and ru2, changed 21 character(s)
There is new method of binary search which may be exist but I didn't see it.↵
↵
Instead of using left and right, we can simply add new bit to our answer if it is possible:↵
↵
~~~~~↵
while bit > 0:↵
   if check(ans + 
plusbit): ↵
      ans += 
plusbit↵
   
plusbit /= 2↵
~~~~~↵
↵
Constant will be much smaller.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru2 Russian ColobocCodeforces 2024-12-04 13:38:04 21
ru1 Russian ColobocCodeforces 2024-12-04 13:37:13 321 Первая редакция (опубликовано)