AtCoder Regular Contest 208 (Div. 2)
E
XY Game
AtCoder
未评级
原题
← D→
翻译中…

Problem Statement

翻译中…

You are given positive integers $N$, $X$, $Y$ and a length-$N$ integer sequence $A=(A_1,A_2,\ldots,A_N)$.

翻译中…

There are $N$ piles of stones, and the $i$-th pile $(1\le i\le N)$ has $A_i$ stones.

翻译中…

Alice and Bob will play the following game using these piles:

翻译中…
  • Starting with Alice, the two players take turns alternately.
  • In each turn, the player chooses one non-empty pile and removes one or two stones from that pile. However, the player cannot make a move such that the number of stones in that pile becomes a multiple of $X$ or a multiple of $Y$ after removing stones.
翻译中…

The player who cannot make a move first loses.

翻译中…

Determine which player wins when both players play optimally.

翻译中…

You are given $T$ test cases, solve each of them.

翻译中…

Constraints

翻译中…
  • $1\le T \le 2\times 10^5$
  • $1\le N \le 2\times 10^5$
  • The sum of $N$ over all test cases is at most $2\times 10^5$.
  • $1\le X < Y\le 10^9$
  • $1\le A_i \le 10^{18}$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

T
\text{case}_1
\text{case}_2
\vdots
\text{case}_T

翻译中…

Each test case is given in the following format:

翻译中…

N X Y
A_1 A_2 \ldots A_N

翻译中…

Output

翻译中…

Output the answers for each test case in order, separated by newlines.

翻译中…

For each test case, print Alice if Alice wins when both players play optimally, and Bob if Bob wins.

翻译中…

样例

Input #1
3
2 3 5
4 12
5 1 2
1 2 3 4 5
6 530 879
17031 42909 97721 34323 39597 26999
Output #1
Alice
Bob
Alice
Consider the first test case. For example, the game proceeds as follows: - Alice removes two stones from the first pile. The first pile has two stones remaining. - Bob removes one stone from the second pile. The second pile has eleven stones remaining. - Alice removes one stone from the first pile. The first pile has one stone remaining. - Bob cannot make a move, so Bob loses and Alice wins. In this test case, Alice always wins no matter how both players make their moves. Therefore, print `Alice` on the first line.
题目信息
题号
arc208_e
时间限制
3 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。