Infinite Grid GameProblem code: IGAME |
All submissions for this problem are available.
After a long period of relaxation Alice and Bob decided to play a game. This time of course not a number game. The rules of the game are as follows:
There is a vehicle situated at the point (m, n) of a rectangular grid. Only one corner of the rectangular grid is defined, i.e. the left-top point (0, 0), which is also known as the origin. The grid extends infinitely towards east and infinitely towards south. Alice and Bob are both sitting in a vehicle, initially situated at the point (m, n). The game they are playing ends as soon as one of them reaches (p, q).
Now, Alice and Bob have to drive the vehicle in their respective turn. In their own turn they can move the vehicle, from (x, y) to (x', y) or (x, y'); where p ? x' < x and q ? y' < y. They can also move the vehicle to the point (x-a, y-a), where 0 < a ? min(x-p, y-q). Also, 0 ? p < m and 0 ? q < n. The winner is the game is the one who drives the vehicle to (p, q).
Cunning Alice uses a biased coin for tossing purpose and always plays first. It is assumed that both Alice and Bob play optimally in their respective turns.
Input
The first line contains a single integer T denoting the number of test cases. T test cases follow. Each test case consists of a single line consisting of four space separated integers m, n, p, q respectively.
Output
For each test case print a string - either "Alice" or "Bob" (without the quotes), denoting the winner.
Constraints
1 ? T ? 1000
1 ? m, n ? 1000
0 ? p < m
0 ? q < n
Sample Input
2 1 1 0 0 2 4 1 2
Sample Output
Alice Bob
Explanation
In the second test case, initially the vehicle is at co-ordinate (2, 4). Alice now has four possible moves. Alice can move the vehicle to position (1, 4), (1, 3), (2, 3) and (2, 2). For all moves that Alice can do, Bob can move the vehicle to the position (1, 2), winning the game.
| Author: | nssprogrammer |
| Date Added: | 7-07-2011 |
| Time Limit: | 2 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
HELP
Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.

Fetching successful submissions

Hi, I am having trouble with
pls ignore the above comment!