atcoder#ARC148D. [ARC148D] mod M Game
[ARC148D] mod M Game
Score : points
Problem Statement
There are integers written on a blackboard, and an integer at least . Alice and Bob will play a game. They will alternately perform the following operation, with Alice going first, until there is no number on the blackboard.
- Choose a number and delete it from the blackboard.
At the end of the game, if the sum of numbers deleted by Alice modulo equals the sum of numbers deleted by Bob modulo , Bob wins; otherwise, Alice wins. Which player will win if both plays optimally?
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
If Alice wins, print Alice
; if Bob wins, print Bob
.
2 9
1 4 8 5
Alice
The game may proceed as follows.
- Alice deletes .
- Bob deletes .
- Alice deletes .
- Bob deletes .
In this case, the sum of numbers deleted by Alice modulo is , and the sum of numbers deleted by Bob modulo is . Since , Alice wins.
3 998244353
1 2 3 1 2 3
Bob