Editorial for DMOPC '21 Contest 1 P1 - Partial Game
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
Note that the Duke can only touch the piles with
Time Complexity:
Subtask 2
Let's look a bit more into the optimal strategy for each player. We say the Duke controls a pile if it contains an even number of stones, and Alice controls a pile if it contains an odd number of stones. The number of moves each player can make is based on the piles which they control. Thus, clearly, it is never optimal to take an odd number of stones from any pile for any player, since it gives control of the pile to the other player (an exception is Alice taking
Moreover, each player would like to maximize the number of moves they can make, which is equivalent to minimizing the number of stones they take from any pile while still keeping it under control. Thus, we can deduce that it is always optimal for both players to take
Time Complexity:
Comments