Блог пользователя SAURAV_05

Автор SAURAV_05, история, 4 года назад, По-английски

Can someone help me with the question whose link is given below. Give an idea on which part to apply binary search.

Your text to link here...

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

You have to apply binary search on the answer (maximum possible amount of energy that can remain in each of accumulators after the transfers of energy).

Assume you have a function check(x), which returns true if it is possible to transfer energy in a way that each accumulator has at least x amount of energy at the end. It is trivial that if check(x) is true, check(y) for y < x is also true. Now binary search can give you the maximum amount of energy that can remain in each of accumulators by calling check() function.