atcoder#AGC056D. [AGC056D] Subset Sum Game

[AGC056D] Subset Sum Game

Score : 16001600 points

Problem Statement

There are NN integers written on a blackboard. The ii-th integer is AiA_i. Here, NN is even. Additionally, integers LL and RR are given.

Alice and Bob will play a game. They alternately take turns, with Alice going first. In each turn, the player chooses a number written on the blackboard and erases it.

The game will end in NN turns. Then, let ss be the sum of the integers erased by Alice. If LsRL \leq s \leq R, Alice wins; otherwise, Bob wins. Find which player will win when both players play optimally.

Constraints

  • 2N50002 \leq N \leq 5000
  • NN is even.
  • 1Ai1091 \leq A_i \leq 10^9
  • 0LR1iNAi0 \leq L \leq R \leq \sum_{1 \leq i \leq N} A_i
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN LL RR

A1A_1 A2A_2 \cdots ANA_N

Output

If Alice wins, print Alice; if Bob wins, print Bob.

4 5 6
3 1 4 5
Alice

In this game, Alice will always win. Below is a possible progression of the game.

  • Alice erases 11.
  • Bob erases 44.
  • Alice erases 55.
  • Bob erases 33.

Here, the sum of the integers erased by Alice is 66. Since L6RL \leq 6 \leq R, Alice wins.

2 2 3
4 1
Bob
30 655 688
42 95 9 13 91 27 99 56 64 15 3 11 5 16 85 3 62 100 64 79 1 70 8 69 70 28 78 4 33 12
Bob
30 792 826
81 60 86 57 5 20 26 13 39 64 89 58 43 98 50 79 58 21 27 68 46 47 45 85 88 5 82 90 74 57
Alice