atcoder#ABC206F. [ABC206F] Interval Game 2
[ABC206F] Interval Game 2
Score : points
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.
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
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.