2002 LSU Computer Science High School Programming Contest

Sponsored by Microsoft

Novice - Problem 1

 MAIN
  Home
  Schedule
  Registration
  Rules
  About
  Language
  Prizes
  
 RESULTS
  Problem Set
  Judge Data
  Solutions
  
 LINKS
  LSU
  Computer Science
  Contest Index
  HS 2001
  HS 2000
  ACM Intl PC
  PC2
 

Fleeing, Floating, Flying

Sam Slacker is a slacker. He's come close to perfecting the art, but every now and then he finds himself having to do something productive for a while so that he actually has some money. Most of the time, however, he manages to get away with playing video games and hanging out with his friends.

One of the latest jobs he lost was on one of the great floating barge-factories of the 2030s. His job was simple--keep the barges floating at the same height so that it was easy to walk across the whole thing, move cargo around, and the like. He managed to sneak a solar-powered PDA with his favourite games on-board, however, and spent more time playing with it than monitoring the barges.

After one stormy night at the barge-factory, the crew woke up to absolute shambles. Some barges were tens of feet over the rest; others were near-sinking. They immediately realized that Sam had fallen asleep on the job, and went to hunt him down. Sam, however, was already making his way to the helipad post-haste. The question is: will he be able to make it there without the crew catching him?

Description:

Your goal is to see if Sam can make it to the helipad before the irate crewmembers catch up with him. Sam's path to the helipad crosses some number of barges, represented by a series of non-negative integers satisfying the statement 0 <= n <= 100, with 0 being right at sea level and 100 being very, very high up. The numbers are given in order; Sam starts at the first one, and progresses to the location of the helipad, one barge at a time.

There are two simple rules that determine whether Sam can move to the next barge:

1. If the next barge is four or less units lower than where Sam currently is, he can jump down to it without being hurt. [If it is the same height, he can simply walk to it.]

2. If the next barge is one higher than where Sam currently is, he can pull himself up to that barge.

If neither of those apply, he is stuck and the crew will catch him. Sam starts on barge 1.

Input:

The first piece of data in the file is the number of simulations to run, represented by a non-negative integer. For each simulation, the first piece of data is the number of barges b, counting the one that Sam starts on, from where he is standing to the edge of the barge-factory. The next piece of data is the location h of the helipad along that path. These numbers satisfy the statement 1 <= h <= b. The next b lines are the heights of the barges in order, one non-negative integer to a line.

Output:

For each simulation, print

	Simulation x: Sam made it to the helipad!
if he can make it to the helipad, or
	Simulation x: Sam got caught by the crew!
if he cannot make it to the helipad. x is the simulation number, starting from 1.

Sample Input:

2		Number of simulations
10		Number of barges in the first simulation
9		Location of helipad in the first simulation
0		Simulation 1, Barge 1
1		Simulation 1, Barge 2
2
3
0
1
2
3
4
1		Simulation 1, Barge 9--the helipad is here
10		Simulation 1, Barge 10
10		Number of barges in the second simulation
9		Location of helipad in the second simulation
10		Simulation 2, Barge 1
11		Simulation 2, Barge 2
12
13
10
11
12
13
24		Simulation 2, Barge 9--the helipad is here
10		Simulation 2, Barge 10

Sample Output:

Simulation 1: Sam made it to the helipad!
Simulation 2: Sam got caught by the crew!



Return to Problem Index



 

The statements and opinions included in these pages are those of 2002 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.
Site maintained by: Isaac Traxler
© 2000,2001,2002    Last modified: Saturday, 26 February, 2005 14:40:39