Confined Catching
문제
You are playing a board game against an AI on a square grid consisting of cells. You have two game pieces and the AI has one, and each piece is placed in one of the grid cells. Your goal is to "catch" the AI's piece, that is, one (or both) of your pieces has to lie in the same cell as the AI's piece after one of your turns. When this happens, you win and the game ends. You lose if you have not won after 600 turns.
Each turn, you have up to five movement options per piece: You can move a piece up, down, left, or right to an adjacent cell (if there is one) or let the piece remain in its current cell. The AI has the same options for its piece in each of its turns. Of course, you can move your pieces completely independently from one another and even have them occupy the same cell.
Your goal is simple: Win the game! You can safely assume that this is always possible.
입력
Before it is your first turn, your program will receive:
- One line with an integer (), giving the size of the grid.
- One line with four integers (), giving your pieces' initial positions.
- One line with two integers (), giving the AI's piece's initial position.
You can safely assume that your pieces do not lie in the same cell as the AI's piece (but they may lie in the same cell as each other).
예제
예제 1
3 1 1 3 1 2 3 3 3 0 0
1 2 3 2 1 2 3 3