Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

SAURAV_05's blog

By SAURAV_05, history, 4 years ago, In English

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...

  • Vote: I like it
  • -3
  • Vote: I do not like it

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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.