atcoder#ARC151C. [ARC151C] 01 Game
[ARC151C] 01 Game
Score : points
Problem Statement
There are squares called square , square , , square , where square and square are adjacent for each .
Initially, of the squares have or written on them. Specifically, for each , is written on square . The other squares have nothing written on them.
Takahashi and Aoki will play a game against each other. The two will alternately act as follows, with Takahashi going first.
- Choose a square with nothing written yet, and write or on that square. Here, it is forbidden to make two adjacent squares have the same digit written on them.
The first player to be unable to act loses; the other player wins.
Determine the winner when both players adopt the optimal strategy for their own victory.
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
If Takahashi wins, print Takahashi
; if Aoki wins, print Aoki
.
7 2
2 0
4 1
Takahashi
Here is one possible progression of the game.
- Takahashi writes on square .
- Aoki writes on square .
- Takahashi writes on square .
Then, Aoki cannot write or on any square, so Takahashi wins.
3 3
1 1
2 0
3 1
Aoki
Since every square already has or written at the beginning, Takahashi, who goes first, cannot act, so Aoki wins.
1000000000000000000 0
Aoki