QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 256 MB Total points: 100

#19997. Child's Game with Robot

Statistics

This is an interactive problem.

Little Misha plays a child’s game with a robot. In this game, the robot stands on a field which is divided into $3 \times 3$ squares and surrounded by borders. The game begins at the center square and consists in making ten actions. Each action is either declamation of a phrase or an attempt to move into one of the neighboring squares. Declamation is used to wait, or simply for amusement.

One of the squares is special, but Misha does not know in advance which one. The robot reports when it moves into the special square. The goal of the game is to move into the special square precisely during the tenth action.

To communicate with the robot, Misha uses text input and output. The following commands are recognized:

  • echo phrase — declamation of phrase,

  • move north — moving one square to the north,

  • move east — moving one square to the east,

  • move south — moving one square to the south,

  • move west — moving one square to the west.

For each declamation command, the robot loudly reads the given phrase, and also prints it back in text. During a declamation, the robot does not move. The robot is guaranteed to correctly handle phrases which consist of characters with ASCII codes from 32 to 126 inclusive and are at most 256 characters long.

For each movement command, the robot prints back one of the four words:

  • bump if instead of moving, the robot hit a barrier, in which case, it remains on the same square,

  • moved if the robot successfully moved into a common square,

  • found if the robot moved into the special square during one of the first nine actions,

  • win if the robot moved into the special square during the tenth action.

Help Misha to play this game in such a way that, during the tenth action, the robot prints the desired word win.

Interaction

The solution must print commands to the standard output, one command per line. To prevent output buffering, flush the output buffer after each command you issue: this can be done by using, for example, fflush (stdout) in C or C++, System.out.flush () in Java, flush (output) in Pascal or sys.stdout.flush () in Python.

The answer for each command is printed back to the solution’s standard input on a separate line.

After printing ten commands, the solution must terminate correctly.

Examples

In the given example, the special square lies to the east from the center. It is guaranteed that this test will be the first when checking your solution.

The commands (solution’s output) are given on the left, and the answers for them (solution’s input) are on the right.

Input 1

moved
moved
found
moved
found
bump
moved
Ready!
Steady...
win

Output 1

move north
move east
move south
move west
move east
move east
move south
echo Ready!
echo Steady...
move north

Note

In each test, the special square is selected in advance and does not change during the contest.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.