Woburn Team Practice '07
Drain Game
The Head Monkey has decided to give the monkeys some recreation time since they've been working so hard lately. She introduces them to a two-player game called the Drain Game. The game is played on an N×N (5 ≤ N ≤ 1001) grid of unit squares, with N an odd integer. The square at the center of the grid (this is well defined, as N is odd) is designated the drain. A single marker is placed on the grid at (row,column) = (R,C), where R, C (0 ≤ R, C ≤ N-1) are 0-based indices.
Players alternate turns. At each turn, a player can move the marker any number of squares horizontally, vertically, or diagonally under the constraint that the Manhattan distance between the new location and the drain is strictly smaller than the Manhattan distance between the current location and the drain. In other words, you must move the marker "towards" the drain. Recall that the Manhattan distance between the pairs (x,y) and (s,t) is simply |x-s|+|y-t|. The player to move the marker into the drain wins.
You are playing against the Head Monkey. It's your turn, and the marker is currently located at (R,C). Can you win?
Input
The first line of the input file contains a single integer T (1 ≤ T ≤ 50), indicating the number of testcases to follow.
Each testcase is a single line listing the three integers N, R, and C.
Output
A single line containing the word "YES" (if you can win) or "NO" (otherwise).
Sample Input
3 5 4 3 5 2 3 55 48 9
Sample Output
NO YES YES
All Submissions
Best Solutions
Point Value: 15 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Aug 31, 2010
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
It's quiet in here...