| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 (추가 시간 없음) | 1024 MB | 1 | 0 | 0 | 0.000% |
This is an interactive problem.
Ivan came up with new rules for the battleship game!
After that, the second player starts his game.
The second player can ask at most 6ドルn$ queries. Please play as the second player and win the game!
The first line contains a single integer $t$ (1ドル \leq t \leq 100$) --- the number of games to be played. You should play $t$ games and finish interaction after that.
At the start of the game, you are given a single integer $n$ (3ドル \leq n \leq 1000$) --- the size of the board.
After that, you can ask some queries. To ask a query, print a single line "? $x$ $y$" (1ドル \leq x, y \leq n$) --- the coordinates of the cell. You will be given an answer $c$:
To finish the game, print a single line "! $x$ $y$", where:
If your answer is incorrect, you will be given a line with value -1, and you should terminate your program. Otherwise, you will be given a line with value 1, and you should play the next game (or finish your program if it was the last game).
It is guaranteed that the sum of $n$ for all games does not exceed 5000ドル$.
It is guaranteed that the board in each game is fixed, and the interactor is not adaptive.
Your solution will get Time Limit Exceeded if you don't print anything or forget to flush the output.
2 3 0 1 4 0 1 1
? 2 1 ! -1 -1 ? 1 3 ? 4 3 ! 2 2
Boards from the first test are shown on pictures below. Rows correspond to $x$ coordinates, columns correspond to $y$ coordinates.