Battleship: New Rules

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

This is an interactive problem.

Ivan came up with new rules for the battleship game!

  • The game will be played on an n×nn \times n board.
  • The first player chooses an integer kk (nkn22n \leq k \leq {\left\lceil \frac{n}{2} \right\rceil}^2).
  • After that, the first player places kk ships on the board so that the number of cells occupied by the ships is the maximum possible (among all valid placements of kk ships of any sizes).
  • Each ship should be a rectangle of size 1×a1 \times a or a×1a \times 1 (aa is any integer from 11 to nn inclusive). Any two ships should not have neighbouring cells (by side or by corner).

After that, the second player starts his game.

  • The second player knows only the size of the board nn.
  • The second player can ask a query: is cell (x,y)(x, y) occupied by some ship?
  • The second player should find any empty 2×22 \times 2 square on the board, or say that there are no such squares.

The second player can ask at most 6n6n queries. Please play as the second player and win the game!

힌트

Boards from the first test are shown on pictures below. Rows correspond to xx coordinates, columns correspond to yy coordinates.

Board from the first game.Board from the second game.