#P14783. [NERC 2025] Battle of Arrays
[NERC 2025] Battle of Arrays
题目描述
Alice and Bob play a turn-based game. Initially, Alice has an array of positive integers, and Bob has an array of positive integers. The players take turns, with Alice moving first.
On a player’s turn, they must choose one element from their own array and the maximal element from their opponent’s array. Then they perform the following operation:
- If : the element is destroyed (removed from the opponent’s array).
- If : the element is decreased by (the value of becomes ).
A player wins if, after their move, the opponent’s array becomes empty.
Assuming both players play optimally, determine the winner.
输入格式
Each input contains multiple test cases. The first line contains the number of test cases (). The first line of each test case contains two integers and () — the sizes of Alice’s and Bob’s arrays respectively.
The second line contains integers () — Alice’s array.
The third line contains integers () — Bob’s array.
It is guaranteed that the sum of over all test cases does not exceed and the sum of over all test cases does not exceed .
输出格式
For each test case, print the name of the winner of the game if both players follow the optimal strategy: “Alice” or “Bob”.
2
1 1
70
90
2 3
30 30
20 20 40
Alice
Bob
提示
In the first test Alice moves and decreases Bob’s element by , so it becomes . Then Bob moves and decreases Alice’s element by , so it becomes . Finally, Alice moves, destroys Bob’s element, and wins.