#arc170d. D - Triangle Card Game
D - Triangle Card Game
Score: points
问题陈述
爱丽丝和鲍勃将进行一场游戏。
最初,爱丽丝和鲍勃各自有N张卡片,爱丽丝的第i张卡片上写着整数A_i,鲍勃的第i张卡片上写着整数B_i。
游戏的进行方式如下:
- 准备一块没有任何字迹的黑板。
- 爱丽丝吃掉她的一张卡片,并将吃掉的卡片上的整数写在黑板上。
- 接下来,鲍勃吃掉他的一张卡片,并将吃掉的卡片上的整数写在黑板上。
- 最后,爱丽丝再吃掉她的一张卡片,并将吃掉的卡片上的整数写在黑板上。
如果用写在黑板上的三个整数作为边长可以形成一个(非退化的)三角形,爱丽丝就赢了;否则,鲍勃赢了。
当两位玩家都采取最优行动时,确定谁赢了。
解决给定的T个测试用例中的每一个。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
Alice and Bob will play a game.
Initially, Alice and Bob each have cards, with the -th card of Alice having the integer written on it, and the -th card of Bob having the integer written on it.
The game proceeds as follows:
- Prepare a blackboard with nothing written on it.
- Alice eats one of her cards and writes the integer from the eaten card on the blackboard.
- Next, Bob eats one of his cards and writes the integer from the eaten card on the blackboard.
- Finally, Alice eats one more of her cards and writes the integer from the eaten card on the blackboard.
If it is possible to form a (non-degenerate) triangle with the side lengths of the three integers written on the blackboard, Alice wins; otherwise, Bob wins.
Determine who wins when both players act optimally.
Solve each of the given test cases.
Constraints
- All input values are integers.
- The sum of over all test cases in a single input is at most .
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
Output
Print lines. The -th line should contain Alice
if Alice wins for the -th test case, and Bob
if Bob wins.
Sample Input 1
3
3
1 2 3
4 5 6
4
6 1 5 10
2 2 4 5
10
3 1 4 1 5 9 2 6 5 3
2 7 1 8 2 8 1 8 2 8
Sample Output 1
Bob
Alice
Alice
In the first test case, for example, the game could proceed as follows:
- Alice eats the card with written on it and writes on the blackboard.
- Bob eats the card with written on it and writes on the blackboard.
- Alice eats the card with written on it and writes on the blackboard.
- The numbers written on the blackboard are . There is no triangle with side lengths , so Bob wins.
For this test case, the above process is not necessarily optimal for the players, but it can be shown that Bob will win if both players act optimally.