시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB0000.000%

문제

Disaster has struck! Niels' precious pet atom has been hit by a cosmic ray, and split up into a mass of individual quarks. Niels is now desperate to find the quarks and piece them together again, and has turned to you for help.

The $N$ quarks are located along a $1$ meter ($10^{18}$ attometers) long line. To your aid you have a very precise (but somewhat quirky) quark microscope, which is able to detect and measure distances to nearby quarks. Due to quantum effects, it cannot directly tell you the location of the nearest quark to a measured position. Instead, it tells you the distance to the second closest! It also determines the number of quarks at that distance.

To be more precise: you can make measurements at integer positions $x$ along the line. For each measurement, the distances $d_1, d_2, \ldots, d_n$ from $x$ to all the quarks will be determined, sorted in increasing order, and you will be given $d_2$, along with the number of indices $i$ such that $d_i = d_2$ (which will be either $1$ or $2$). After performing enough measurements, you should answer with the positions of all the quarks.

Each quark has an integer position between $1$ and $10^{18}$ attometers, counting from the start of the line. No two quarks will occupy the same position (as per the Pauli exclusion principle).

Depending on the number of measurements performed, your program will receive different amounts of points.

인터랙션

Your program will interact with the judge by reading from standard in and writing to standard out. First, the judge will output a line containing the number of quarks $N$ ($3 \le N \le 100$) and the number of the test group $T$ ($1 \le T \le 3$).

Then, your program can make queries of the following forms:

  • ? x ($-10^{18} \le x \le 2\cdot 10^{18}$): find the distance to the second closest quark to $x$. The judge will respond with two space-separated numbers $r$, $m$, where $r$ is the distance to the second closest quark, and $m$ is the number of quarks at that distance (either $1$ or $2$).
  • ! $a_1$ $a_2$ $\ldots$ $a_n$: guess the positions of the quarks ($1 \le a_i \le 10^{18}$). $a_1, a_2, \ldots, a_n$ may be given in any order. No additional queries should be made after this.

After each query, you should make sure to flush standard output before reading the judge's response, or your solution may end up graded as Time Limit Exceeded. In Python this happens automatically, and in C++ it happens when using cout << endl; to print a newline. In C you can use fflush(stdout); after printf.

If you make an invalid query, your program may receive either Wrong Answer or Run Time Error.

To facilitate testing of your solution, we provide a simple tool that you can download at the top of this page. See the comment at the top of the file for a description of how to use it.

서브태스크

번호배점제한
140

One of the quarks is located at position $1$

240

All coordinates are even

320

No additional constraints

For each subtask, let $Q$ be the maximum number of ?-type queries used across any test case in that subtask. Then for that subtask $r$ is defined according to the following table:

Constraints r
$Q > 15\,000$ 0
$15\,000 \ge Q > 5\,600$ 0.4
$5\,600 \ge Q > 3\,500$ 0.6
$3\,500 \ge Q > 2\,400$ 0.8
$2\,400 \ge Q$ 1

예제 입력 1

3 3

6 1

4 1

1 2

예제 출력 1


? 5

? 15

? 11

! 11 10 12

예제 입력 2

3 1

2 1

1 2

2 1

45 1

예제 출력 2


? 1

? 2

? 3

? 47

! 1 3 92

출처

Olympiad > Nordic Olympiad in Informatics > 2022 C번

  • 문제를 만든 사람: David Rasmussen Lolck, Simon Lindholm

채점 및 기타 정보

  • 예제는 채점하지 않는다.
  • 이 문제의 채점 우선 순위는 2이다.