#abc206f. F - Interval Game 2
F - Interval Game 2
Score : points
问题描述
对于 个测试用例,解决以下问题。
我们有 个半开区间 ()。使用这些区间,Alice 和 Bob 将进行以下游戏:
- Alice 和 Bob 交替执行以下操作,Alice 先手:
- 从 个区间中选择一个不与已选择的任何区间相交的区间。
无法执行该操作的玩家输掉比赛,而另一名玩家获胜。
如果两名玩家都采取最优策略来赢得比赛,那么哪位玩家会获胜?
什么是半开区间? 半开区间 是指满足 的所有实数 构成的区间。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Solve the problem below for test cases.
We have half-open intervals (). Using them, Alice and Bob will play the following game:
- Alice and Bob alternately do the following operation, Alice going first.
- From the intervals, choose one that does not intersect with any of the intervals that are already chosen.
The player who gets unable to do the operation loses, and the other player wins.
Which player will win if both players play optimally to win?
What is a half-open interval?A half-open interval is an interval consisting of all real numbers satisfying .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input. The first line is in the following format:
Then, test cases follow, each of which is in the following format:
Output
Print lines.
The -th line should contain Alice
if Alice wins in the -th test case, and Bob
if Bob wins.
Sample Input 1
5
3
53 98
8 43
12 53
10
4 7
5 7
3 7
4 5
5 8
6 9
4 8
5 10
1 9
5 10
2
58 98
11 29
6
79 83
44 83
38 74
49 88
18 45
64 99
1
5 9
Sample Output 1
Bob
Alice
Bob
Alice
Alice
This input contains five test cases.
For the first test case, we will show one possible progression of the game below.
- Alice chooses the interval .
- Bob chooses the interval . Note that and do not intersect since they are half-open.
- Alice is unable to do an operation, and Bob wins.
These moves may not be the best choices for them, but we can show that Bob will win if both play optimally.
As seen in the second test case, there can be multiple occurrences of the same interval within a test case.
update @ 2024/3/10 09:19:54