2001 LSU Computer Science High School Programming Contest

Sponsored by Texas Instruments

Veteran - Problem 7

 MAIN
  Home
  Schedule
  Registration
  Rules
  About
  Language
  
 RESULTS
  Standings
  Problem Set
  
 LINKS
  LSU
  Computer Science
  Contest Index
  HS 2000
  ACM Intl PC
  PC2
  
 THANKS
  Sponsor
  Schools
  Volunteers
 

Put A Little Birdbath In Your Yard

Problem: Dr. Brownian's eclecticism extends to his home life. Living in a house precisely e storeys tall (not stories, mind you), with decor that can only properly be called Machiavellian, the Brownian household is definitely one of the most talked-about in the area.

This, er, uniqueness extends to the front lawn of the home as well. A number of statues of various major scientific figures -- Einstein, Heisenberg, Brahe, Beeblebrox -- stand in the yard. This in itself may not be particularly impressive, but the fact that they move around seeming of their own accord in the middle of the night is somewhat more impressive.

Of course, the movement needs no bizarre explanation. (Well, bizarre for the Brownians.) There is a grid of track under the yard, and the statues can move around on the grid without disturbing the grass. There are 25 possible locations for the statues in the yard, laid out in a five by five array. The Brownians own six statues, although not all of them are in the yard at a given time.

Well, Dr. Brownian decided that the front yard needed something a little extra. While out searching for that perfect item to complete the garden, he saw a birdbath at a gargae sale. It was no ordinary birdbath - it had a whale that constantly blows water out of its blowhole (when connected to a source of water). Upon first sight, he knew it belonged. He was so excited that he loaded it up and took it home immediately.

Unfortunately, the situation turned sour. By the time that Dr. Brownian got home, a torrential downpour had turned the lawn into a slick morass of mud and grass. Being the hardheaded man that he is, Dr. Brownian nonetheless wants to install the birdbath this very minute.

And herein lies your problem. Given a starting location for the birdbath, and the current location of the statues, you must say whether or not a given series of moves will put the birdbath in the center of the yard. There's a catch, of course -- once you start moving the birdbath in a direction, it won't stop moving until it hits something. And if it goes off the edge of the yard, the neighbors won't be happy with their new "present" or the hole in their fence.

Notes:

  • The grid is numbered from 1 to 5, and x coordinates come before y coordinates with 1 being the bottom/south left/west corner.
  • Movements are signified by a number:
    NumberDirection
    8Up/North
    6Right/East
    2Down/South
    4Left/West
Input: The data file format is as follows:
number of maps
birdbath starting row 
birdbath starting column
number of statues
statue 1 row
statue 1 column
. . .

Output: For each map, print one of three things:
Output    Condition
BIRDBATH IN YOUR YARD    the birdbath ends up in the center of the lawn
BIRDBATH IN THE FENCE    the birdbath ends up sliding off of the lawn
BIRDBATH IN THE WAY    the birdbath ends up still on the yard, but not in the center

Sample Input:

3		number of puzzles
1		starting row for birdbath
1		starting column for birdbath
2		number of statues
1		row of first statue
4		column of first statue
4		row of second statue
3		column of second statue
2		number of pushes
6		direction of first push
8		direction of second push
1		starting row of birdbath
5		starting column of birdbath
1		number of statues
1		row of the statue
1		column of the statue
1		number of pushes
4		direction of push
1		starting row of birdbath
5		starting column of birdbath
1		number of statues
1		row of statue
1		column of statue
2		number of pushes
4		direction
8		direction

Sample Output:

BIRDBATH IN YOUR YARD
BIRDBATH IN THE WAY
BIRDBATH IN THE FENCE


 

The statements and opinions included in these pages are those of 2001 LSU Computer Science High School Programming Contest only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 2000,2001 Isaac Traxler
Last modified: Friday, 01 July, 2011 16:24:51