All submissions for this problem are available.
Alice and Bob are playing a game. There have a very large checker board whose rows and columns are numbered from 0 onwards. A single counter is placed at an initial square (X,Y). Alice plays first and they take alternate turns. In each turn, if the counter was initially at square (x,y) then it can be moved to any square (a,b) which satisifes the following conditions :
1) 0 <= a <= x and 0 <= b <= y (but a = x and b = y is not allowed, i.e the counter must be moved)
2) (a,b) must be VISIBLE from (x,y) . Two squares are VISIBLE to each other if, on joining the centres of these two squares by a straight line segment, no other centre of a square lies on that line segment in between these two centres.
The first person who cannot make a move loses (i.e. the person who has to make a move when the counter is at square(0,0) loses, the other person wins)
Your task is to determine who wins, and the number of moves the game lasts, if both players play optimally. Note that the winner tries to win as quickly as possible, while the loser tries to delay his loss for as long as possible.
The first line contains a single number T (T<=100) the total number of test cases.
T lines follow, each containing a single test case. Each such line contains two space separated numbers X and Y, denoting the initial position of the counter. (0 <= X <= 10^18, 0 <= Y <= 10^18).
Output T lines, one for each test case, containing the name of the winner and the number of moves the game lasts, if both players play optimally.
Input: 2 1 1 2 0 Output: Alice 1 Bob 2 Explanation
In the first case Alice can directly move the counter to square (0,0) thereby winning the game in 1 move. In the second case the only square Alice can move to is square (1,0). She cannot move the counter to
(0,0) because (1,0) lies on the line segment joining (2,0) and (0,0). After that Bob moves it to (0,0),
thereby winning in 2 moves.
|Time Limit:||0.152 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, D, PERL, FORT, ADA, ASM, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, SCM guile, TCL, CLOJ, FS|
Fetching successful submissions