Codeforces Round 982 (Div. 2)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
2027 Codeforces Round 982 (Div. 2) FINISHED False 7200 46452323 Oct. 26, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 247 ) E1 Bit Game (Easy Version) PROGRAMMING bitmasks brute force games math

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. 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). 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

Tutorials

Codeforces Round #982 (Div. 2) Editorial

Submissions

No solutions yet.