22000_BlindWalk

2022-5-16 18:21| 发布者: Hocassian| 查看: 25| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-8950630121800-Problem List-采集的数据-后羿采集器.html

Pro.ID

22000

Title

Blind Walk

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22000

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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 n × m ( 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.

    输入

    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.

    输出

    Description

    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 n × m ( 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.

    Input

    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.

    Output

    Each line of the standard output represents robot's action. It is one of the following ve strings: SOUTH, WEST, NORTH, EAST, or DONE. DONE must be printed when the robot has visited all empty cells. After printing DONE your program must exit. You must  flush standard output after printing each action.

    Sample Input

    NORTH
    EAST
    SOUTH
    EAST
    SOUTH
    WEST
    SOUTH
    WEST
    NORTH
    WEST
    WEST
    NORTH
    EAST
    NORTH
    DONE

    Sample Output

    BLOCKED
    BLOCKED
    EMPTY
    BLOCKED
    BLOCKED
    EMPTY
    BLOCKED
    BLOCKED
    EMPTY
    EMPTY
    BLOCKED
    BLOCKED
    EMPTY
    BLOCKED

    Source

    样例输入

    NORTH
    EAST
    SOUTH
    EAST
    SOUTH
    WEST
    SOUTH
    WEST
    NORTH
    WEST
    WEST
    NORTH
    EAST
    NORTH
    DONE

    样例输出

    BLOCKED
    BLOCKED
    EMPTY
    BLOCKED
    BLOCKED
    EMPTY
    BLOCKED
    BLOCKED
    EMPTY
    EMPTY
    BLOCKED
    BLOCKED
    EMPTY
    BLOCKED

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部