#P7356. Interactive Black and White Game

    ID: 20554 Type: Default 1000ms 256MiB

Interactive Black and White Game

Interactive Black and White Game

This is an interactive problem. In this game you play as the white piece while the interactor (the judge) plays as the black piece. The game takes place on a Cartesian coordinate system restricted to the origin, the positive x and y axes, and the first quadrant. Both players may only place pieces at points where both coordinates are natural numbers. The game starts with the interactor placing a black piece at \( (0,0) \) (this move is made automatically and needs no input). Black moves first.

A win for white is achieved when there exists a contiguous sequence in any one of the horizontal, vertical, or diagonal directions matching the pattern \( \text{black white white white} \). Moreover, if you win in \( x \) moves with \( x \le 13 \), you obtain a score fraction of \( \frac{\min(14-x,10)}{10} \) for that game.

Interaction Protocol:

  1. The first input is an integer \( T \) representing the number of games.
  2. For each game, note that the interactor automatically plays the first move at \( (0,0) \) without any input from you.
  3. Then, until you have either made 14 moves or have won, repeat the following two steps:
    1. You output a line with two integers \( x \) and \( y \) representing your move (white's move).
    2. You then read a line of two integers \( x \) and \( y \) representing the interactor's move (black's move). If you have just won by your move, no interactor move is read and the game moves on to the next game.

Special Rules:

  • All your moves must have coordinates in the range \( [0, 100] \). If you output a coordinate outside this range, the game immediately ends after 14 moves.
  • If a move is made on an already occupied spot, that move is treated as a pass (i.e. you forfeit your chance to place a piece). The interactor may also choose to pass by the same rule.
  • The final score awarded to you is the minimum score fraction you achieved among all \( T \) games.

inputFormat

The input starts with an integer \( T \) denoting the number of games. For each game, after an automatic first move by the interactor (black's move at \( (0,0) \)), your program will operate in rounds. In each round, you must output a white move (two space-separated integers) and then read a line representing the interactor's (black) move, except possibly after your winning move if you win before reaching 14 moves. All interactor moves are guaranteed to be within the range \( [0,100] \).

outputFormat

In each round, output a line containing two space-separated integers representing your white move. This output is used for real-time interaction with the judge. There is no final consolidated output.

sample

1
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
1 1

2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14

</p>