| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 1 | 0 | 0 | 0.000% |
This is an interactive problem.
There is a $2 \times n$ grid ($2 \leq n \leq 1000$), where rows are numbered from $0$ to $1$, and columns are numbered from $0$ to $n - 1$. Each cell of the grid has flow in one of the four directions: up, down, left, or right. The flow directions in the grid form a continuous cycle, either clockwise or counterclockwise. Here is an example of the grid with clockwise-directed flow:
You are playing a two-round game. At the start of each round, a token is placed on some cell. You make moves, and before every move, you know the token's current position. The goal is to drop one token from the left side of the grid and drop another token from the right side. It does not matter which side is used in which round. The size of the grid and the direction of the flow are unknown, but are fixed in advance. They do not change between rounds.
There is a list of possible moves:
Before each move, you are given the current coordinates of the token. You are allowed to use a limited number of moves. See details in the next section.
At the start of each move, the jury's program prints a line with two integers $r$ and $c$: the current row and column of the token, respectively. Then the participant's program should output a line with one of the following commands:
left". Move the token to the left.right". Move the token to the right.switch". Move the token to the opposite row.wait $T$". Wait for $T$ seconds. $T$ is an integer between $0$ and $2002$.After the command, the jury's program prints a separate line with either "yes" if the token fell from the grid, or "no" otherwise. After the first token falls, the second round starts, and the second token comes into play. After both tokens fall from the grid, the participant's program should terminate. The second token should be dropped from the side opposite to where the first one was dropped.
The limits are as follows:
left, right, wait commands in the first round must not exceed $4$.left, right, wait commands in the second round must not exceed $3$.switch command can only be used once in each round.0 5 no 1 5 no 1 18 no 1 19 yes 1 2 no 0 2 no 0 1 no 0 0 yes
wait 11 wait 13 right right switch left left left