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

31344번 - Game with coins 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
12 초 1024 MB1000.000%

문제

This problem is interactive.

Taja can easily win this game, but all of her friends couldn't. Now she offers you to play this game.

Game equipment consists of field $n \times n$ (5ドル \leq n \leq 40$), the piece, two coins (COIN1, COIN2), two dices with cardinal directions (DICE1, DICE2), and a lot of one cell size blocks.

Name Number of faces Faces
COIN1. Move coin 2 SLIDE, RAM
COIN2. Modification coin 2 PLACE, REMOVE
DICE1. First dice with directions 4 N (North), S (South), W (West), E (East)
DICE2. Second dice with directions 8 N (North), S (South), W (West), E (East), NW (Northwest), NE (Northeast), SW (Southwest), SE (Southeast)

Before the beginning of the game the piece and some blocks are placed on the field. Then the player makes moves such kind. At first, the player chooses a coin and tosses it for determine an action. Then he chooses one of the dices and rolls it for determine direction $dir$. After that one of the four action happens:

Coin string Action
SLIDE Move the piece along empty cells in the direction of $dir,ドル until the piece collides a block or maze border
RAM Move the piece along empty cells in the direction of $dir,ドル until it collides a first block. Then move the piece and the block in the same direction, until moving block collides another block or field border
PLACE If adjacent cell in the direction $dir$ next to the piece is empty and is in the field, place a block on this cell
REMOVE If adjacent cell in the direction $dir$ next to the piece contains a block and is in the field, remove the block from this cell

The goal is to put the piece on the finish cell.

One query for this problem is one coin toss and one dice roll.

인터랙션

At first, interactor gives the size of the maze, the maze and coordinate of the finish cell. Then the following 4ドル$-step actions are happens:

  1. Jury's program displays coordinates of the piece or inform that the piece has reaches the finish cell.
  2. Your program displays the coin name.
  3. Jury's program displays the name of the action on the coin.
  4. Your program displays the dice name.
  5. Jury's program displays the name of the direction on the dice and additional information for action "RAM".

입력

First line of the standard input contains one integer number $n$ --- the size of the maze. Next $n$ lines contains $n$ characters "." (ASCII 46ドル$) or <<\#>> (ASCII 35ドル$), denoting empty cell and cell with block respectively.

Next line contains two integer numbers $r_f$ and $c_f$ --- row number and column number of the finish cell. The upper-left corner is $(1, 1),ドル the bottom-right is $(n, n)$. Finish cell and initial cell are empty.

Next groups describes each move:

  • The first line of an group contains two integer numbers $r,ドル $c$ --- row number and column number of the piece, or $(-1, -1),ドル if the peace reaches the finish cell.
  • Next line contains action name shown on the coin.
  • Next line contains direction name shown on the dice.
  • If the current action is "RAM", next two strings contains two integer numbers $r_1,ドル $c_1$ and $r_2,ドル $c_2,ドル denotes then the piece collides a block with coordinates $(r_1, c_1)$ and moves that block to the cell $(r_2, c_2)$.

The north direction corresponds to decreasing row number. The south to increasing row number. The west direction to decreasing column number. The east direction to increasing column number.

Each side of any coin or dice is shown with the same probability.

출력

The standard output should consist of pair of lines: coin name and dice name. Coin name is the string "COIN1" or "COIN2". Dice name is the string "DICE1" or "DICE2".

제한

예제 입력 1

5
#....
.....
.....
.....
..#..
4 3
1 5
PLACE
W
1 5
RAM
S
6 5
6 5
5 5
RAM
W
5 3
5 1
5 2
PLACE
NE
5 2
RAM
NE
4 3
2 5
3 4
REMOVE
NE
3 4
PLACE
S
3 4
SLIDE
W
3 1
RAM
S
5 1
5 1
4 1
SLIDE
E
-1 -1

예제 출력 1

COIN2
DICE1
COIN1
DICE1
COIN1
DICE1
COIN2
DICE2
COIN1
DICE2
COIN2
DICE2
COIN2
DICE1
COIN1
DICE1
COIN1
DICE1
COIN1
DICE1

힌트

The initial state of the maze for the sample is

And the representation of the path is shown below:

COIN2 $\rightarrow$ PLACE

DICE1 $\rightarrow$ W

COIN1 $\rightarrow$ RAM

DICE1 $\rightarrow$ S

COIN1 $\rightarrow$ RAM

DICE1 $\rightarrow$ W

COIN2 $\rightarrow$ PLACE

DICE2 $\rightarrow$ NE

COIN1 $\rightarrow$ RAM

DICE2 $\rightarrow$ NE

COIN2 $\rightarrow$ REMOVE

DICE2 $\rightarrow$ NE

COIN2 $\rightarrow$ PLACE

DICE1 $\rightarrow$ S

COIN1 $\rightarrow$ SLIDE

DICE1 $\rightarrow$ W

COIN1 $\rightarrow$ RAM

DICE1 $\rightarrow$ S

COIN1 $\rightarrow$ SLIDE

DICE1 $\rightarrow$ E

출처

Contest > Open Cup > 2014/2015 Season > Stage 9: Grand Prix of Udmurtia I번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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