SuperMo's blog

By SuperMo, 46 hours ago, In English

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?

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

»
45 hours ago, # |
  Vote: I like it +7 Vote: I do not like it

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.