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

Автор SuperMo, 5 месяцев назад, По-английски

Hi, in problem C of the last educational round, why is it wrong to loop from 1 to n and increase the minimum if both are equal to 1, and decrease the maximum if both are -1?

How did so many people know that this was wrong and decide to first calculate the guaranteed rating of the first movie and the guaranteed rating of the second movie, and only then apply the greedy algorithm of decreasing the maximum and increasing the minimum? What is the difference, and how can I notice it?

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

»
5 месяцев назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

I actually got wa on 2 at first because I did what you said and then I realized you have to calculate the guaranteed ones at first. The reason for this is you wanna balance as much as possible so the minimum is as close to maximum as possible. You might end up balancing at first and then the guaranteed ones can ruin your balance. So it's always the best to take the guaranteed ones and then balance.