No.2278 Time Bomb Game 2
Problem Statement
There are $N$ cells arranged in a row from left to right. The $i$-th cell from the left is called cell $i$. Each cell has a character A or B written on it, and the character written on cell $i$ is $c_i$. There is also $1$ coin, placed on cell $K$.
Alice and Bob play a game using these cells and the coin. When the character written on the cell where the coin is placed is A, it is Alice's turn; when it is B, it is Bob's turn. The player whose turn it is takes one of the following actions.
- Move the coin to the cell immediately to the left. This action can be taken only if a cell exists immediately to the left.
- Move the coin to the cell immediately to the right. This action can be taken only if a cell exists immediately to the right.
A, Alice loses, and if it is B, Bob loses. The player who did not lose wins. When the $2$ players act optimally, who wins?
Input
$N$ $K$ $T$ $c_1 c_2 \ldots c_N$
- $N, K, T$ are integers.
- $2 \leq N \leq 2 \times 10^5$
- $1 \leq K \leq N$
- $1 \leq T \leq 10^9$
- $c_i$ is
AorB.
Output
Print Alice if Alice wins, and Bob if Bob wins. Print a newline at the end.
Sample
Sample 1
Input
5 1 5 AAABA
Output
Alice
Initially, the coin is placed on cell $1$, and it is Alice's turn. The game may proceed, for example, as follows.
- Alice moves the coin to cell $2$.
- Alice moves the coin to cell $3$.
- Alice moves the coin to cell $4$.
- Bob moves the coin to cell $3$.
- Alice moves the coin to cell $4$.
Sample 2
Input
6 4 1 BAAAAB
Output
Bob
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
miscalc
magsta