Editorial for COCI '23 Contest 3 #2 Vrsar
Submitting an official solution before solving the problem yourself is a bannable offence.
The most important observation for this task is that it will always be possible to have an optimal solution that uses only one ice rink.
Proof: Let us assume that some optimal solution uses multiple ice rinks. Look at the ice rink where Iva and Mia skate last. The solution would be the same if they went directly to that ice rink. They will not spend any more time traveling to it (because they have to reach it in both solutions), and every minute that was spent skating on other ice rinks could be spent skating on the last one.
With that observation, we can simplify the task a bit. We do not need the time to descend from hills. For
every starting position, we have to find the maximum of for every
. That can be done in
many ways; the official solution uses two sets, one for the positions left of the current, and one for the
positions right of the current position.
Comments