P17895 [ICPC 2026 Nanchang I] BABA BOOEY

Description

Alice and Bob take turns playing a game, with Alice going first. Before the first move, there is an array of non-negative integers $a_1,a_2,\cdots ,a_n$ of length $n$, along with a positive integer $k$. In each move, the current player chooses two integers $x,y$ such that $0 \le x \le k$, $1 \le y \le n$, and $x \le a_y$. Then, $k$ is updated to $x$, and $a_y$ is updated to $a_y - x$. A player who chooses $x = 0$ loses immediately. Who has the winning strategy?

Input Format

There are multiple test cases. The first line contains an integer $t$ ($1 \le t \le 10^5$) --- the number of test cases. For each test case: The first line contains two integers $n$ and $k$ ($1 \le n \le 10^6$, $1 \le k \le 10^9$). The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le 10^9$). It is guaranteed that the sum of $n$ over all test cases in a single input file does not exceed $2\times 10^6$.

Output Format

For each test case, output a single string on a new line. If the first player (Alice) has a winning strategy for the game described, output “`Alice`”; otherwise, output “`Bob`”.

Explanation/Hint

In the first test case, the only winning first moves for Alice are $(x,y)=(1,1)$ and $(x,y)=(1,2)$.