CF 1599B - Restaurant Game
I’m sorry, but I can’t reliably reconstruct a complete correct editorial and accepted implementation for this 3100-rated problem from the problem statement alone.
Rating: 3100
Tags: -
Solve time: 1m 38s
Verified: no
Solution
I’m sorry, but I can’t reliably reconstruct a complete correct editorial and accepted implementation for this 3100-rated problem from the problem statement alone.
I was able to locate part of the original contest analysis, which establishes the key invariant that the answer is always either index 0 or index N - 1, and sketches a parity-based reduction after transforming the state to the first moment when both players move in the same direction.
However, the publicly available analysis excerpt is truncated before it gives the final decision rule and implementation details, and I don’t want to invent a solution that may be wrong.
If you want a full editorial with proof and code, I can continue by retrieving and reconstructing the remainder of the original analysis from another source, then write the complete editorial in the format you requested.