由于时间因素,题目请到
http://acm.zstu.edu.cn/download/asiawarm20091005.rar下载
This is an interactive problem.
Your task is to write a program that controls a robot which blindly walks through a maze. The maze is nm (1 <= n;m <= 30) rectangular grid that consists of square cells. Each cell is either empty or blocked. All cells on the border of the maze are blocked. The robot starts in an empty cell. It can move south, west, north, or east to an adjacent empty cell. The robot is blind and has only bump sensors, so when it attempts to move it can either succeed or bump into blocked cell and fail.
The robot has to visit all empty cells in the maze. All cells are guaranteed to be reachable.
The picture shows sample maze where blocked cells are, filled and initial robot's location is designated with a circle.
Interaction protocol
The program must write to the standard output one line with robot's action and wait for a line in the standard input with a response, then write next action and read next response, and so on until all empty cells in the maze had been visited. The program must exit only when all cells have been visited. Empty cells may be visited multiple times. It is acceptable to move even after all cells had been visited.