Logo
(追記) (追記ここまで)

6920번 - Blindfold 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB1612685.714%

문제

Rose and Colin are playing a game in their backyard. Since the backyard is rectangular, we can think of it as a grid with $r$ rows and $c$ columns. Rose and Colin place obstacles on some of the squares.

The game is played as follows:

Colin covers his eyes with a blindfold then Rose carries him to some grid square in the backyard. She sets him down so that he is facing north, south, east, or west. Colin does not know this initial position or direction. Rose then instructs Colin to make a series of $m$ moves through the backyard. Each move is one of:

  • F - moves forward one grid square in the direction that he is facing, or
  • L - turns 90 degrees counter-clockwise, remaining on the same square, or
  • R - turns 90 degrees clockwise, remaining on the same square.

After making these moves, Colin is standing at some final position. He must now figure out where he is standing. You will help him by writing a program to determine all possible final positions. Assume that Colin's initial position, final position, and all intermediate positions lie within the backyard but never in a square that contains an obstacle. You may also assume that Colin is always facing a direction that is parallel to the sides of the backyard (north, south, east, or west).

입력

The input begins with $r$ and $c$ $(1 \le r \le 375; 1 \le c \le 80),ドル each on a separate line. Next are $r$ lines of $c$ characters describing the backyard: a . denotes a grid square that Colin may walk through; an X denotes a grid square with an obstacle. Below the grid is the number $m$ $(0 \le m \le 30,000円)$ followed by $m$ lines describing Colin's moves. Each line has a single character: F, L, or R.

출력

Your program should output the backyard grid, indicating all possible final positions with *.

제한

예제 입력 1

2
4
....
.XX.
3
F
R
F

예제 출력 1

.*..
.XX*

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2002 > CCC 2002 Junior Division 5번

Olympiad > Canadian Computing Competition & Olympiad > 2002 > CCC 2002 Senior Division 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /