Cunning Friends
Time limit2sMemory limit64 MB
Three players take turns removing stones from piles; Ben and Chris cooperate to make Anthony lose, so decide whether Anthony can avoid defeat.
- Level
Hard8 of 10
- Topics
- Game theory, Greedy, Math, Combinatorics
- Solved
- No attempts yet
Problem
Anthony plays a stone game with his friends Ben and Chris. There are piles of stones, and pile holds stones. On a turn the player to move picks one pile and takes any number of stones from it, at least one. The turn order is Anthony, then Ben, then Chris, and it repeats. The player who has no stone left to take on their turn loses.
Ben and Chris agreed in advance to make Anthony lose. Neither of them cares which of the two ends up losing, they only want Anthony to lose. Anthony does not want to lose. All three play optimally. Decide whether Anthony can avoid defeat.
Input
The first line contains the number of piles ().
The second line contains the integers separated by spaces ().
Output
Print Lose if Anthony loses, and Win if he can avoid defeat.