아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Blind Walk

시간 제한1초메모리 제한512 MB

요약
충돌 감지만 가능한 로봇을 조종해, 미로의 모든 빈 칸을 방문할 때까지 탐색하고 되돌아오는 문제입니다.
난이도

보통10점 중 7점

유형
DFS, 백트래킹, 시뮬레이션
정답자
아직 제출이 없습니다

문제

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.

입력

Each line of the standard input represents response on robot’s action. It is either a string EMPTY if robot has successfully moved in the specified direction to an adjacent cell or a string BLOCKED if robot’s movement has failed because the corresponding adjacent cell was blocked.

출력

Each line of the standard output represents robot’s action. It is one of the following five 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.

예제1

  1. 예제 1

    입력
    BLOCKED
    BLOCKED
    EMPTY
    BLOCKED
    BLOCKED
    EMPTY
    BLOCKED
    BLOCKED
    EMPTY
    EMPTY
    BLOCKED
    BLOCKED
    EMPTY
    BLOCKED
    
    예상 출력
    NORTH
    EAST
    SOUTH
    EAST
    SOUTH
    WEST
    SOUTH
    WEST
    NORTH
    WEST
    WEST
    NORTH
    EAST
    NORTH
    DONE