Codeforces Round 982 (Div. 2) |
---|
Finished |
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:
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.
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 < 2^{30}$$$).
The third line of each test case contains $$$n$$$ integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i < 2^{30}$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^4$$$.
Print a single line with the winner's name. If Alice wins, print "Alice", otherwise print "Bob" (without quotes).
721 610 7310 8 1525 4 1448 32 65 647 45 126 94320 40 123 55 1512345 9876 86419 8641 16789 54321 7532 97532 1220 6444 61357 109 5569 90 85
Bob Bob Bob Bob Bob Alice Alice
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 > 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.
Name |
---|