Codeforces Round 982 (Div. 2)
E1
Bit Game (Easy Version)
Codeforces
2800
原题
← D2E2 →
翻译中…

This is the easy version of this problem. The only difference is that you need to output the winner of the game in this version, and the number of stones in each pile are fixed. You must solve both versions to be able to hack.

翻译中…

Alice and Bob are playing a familiar game where they take turns removing stones from $n$ piles. Initially, there are $x_i$ stones in the $i$-th pile, and it has an associated value $a_i$. A player can take $d$ stones away from the $i$-th pile if and only if both of the following conditions are met:

翻译中…
  • $1 \le d \le a_i$, and
  • $x \, \& \, d = d$, where $x$ is the current number of stones in the $i$-th pile and $\&$ denotes the bitwise AND operation.
翻译中…

The player who cannot make a move loses, and Alice goes first.

翻译中…

You're given the $a_i$ and $x_i$ values for each pile, please determine who will win the game if both players play optimally.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 1000$). The description of the test cases follows.

翻译中…

The first line of each test case contains $n$ ($1 \le n \le 10^4$) — the number of piles.

翻译中…

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \lt 2^{30}$).

翻译中…

The third line of each test case contains $n$ integers $x_1, x_2, \ldots, x_n$ ($1 \le x_i \lt 2^{30}$).

翻译中…

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^4$.

翻译中…

Output

翻译中…

Print a single line with the winner's name. If Alice wins, print "Alice", otherwise print "Bob" (without quotes).

翻译中…

Note

翻译中…

In the first test case, neither player can take any stones from the first pile since there is no value of $d$ satisfying the conditions. For the second pile, to begin with, Alice can remove between $1$ and $6$ stones. No matter which move Alice performs, Bob can remove the rest of the stones on his turn. After Bob's move, there are no more moves that Alice can perform, so Bob wins.

翻译中…

In the second test case, here is one example of how the game might go. Alice moves first, and she decides to remove from the first pile. She cannot take $17$ stones, because $17 \gt 10$, which fails the first condition. She cannot take $10$ stones, because $25 \, \& \, 10 = 8$ which fails the second condition. One option is to take $9$ stones; now the pile has $16$ stones left. On Bob's turn he decides to take stones from the second pile; the only option here is to take all $4$. Now, no more stones can be taken from either of the first two piles, so Alice must take some stones from the last pile. She decides to take $12$ stones, and Bob then follows by taking the last $2$ stones on that pile. Since Alice now has no legal moves left, Bob wins. It can be shown that no matter which strategy Alice follows, Bob will always be able to win if he plays optimally.

翻译中…

样例

Input #1
7
2
1 6
10 7
3
10 8 15
25 4 14
4
8 32 65 64
7 45 126 94
3
20 40 1
23 55 1
5
12345 9876 86419 8641 1
6789 54321 7532 97532 1
2
20 64
44 61
3
57 109 55
69 90 85
Output #1
Bob
Bob
Bob
Bob
Bob
Alice
Alice
InputCopy OutputCopy
题目信息
题号
2027E1
时间限制
2 s
内存限制
256 MB
标签
位运算
暴力
博弈论
数学

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