WC '07 P4 - Drain Game

View as PDF

Submit solution

Points: 15 (partial)
Time limit: 1.0s
Memory limit: 16M

Problem type
Woburn Team Practice '07

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 \times N (5 \le N \le 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 (\text{row},\text{column}) = (R,C), where R, C (0 \le R, C \le 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 Specification

The first line of the input file contains a single integer T (1 \le T \le 50), indicating the number of test cases to follow.

Each test case is a single line listing the three integers N, R, and C.

Output Specification

Output the following for each test case:

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

Comments

There are no comments at the moment.