#P10645. [NordicOI 2022] 夸克显微镜 Quark Microscopy

    ID: 12123 远端评测题 1000ms 1024MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>2022交互题Special JudgeNordicOI(北欧)

[NordicOI 2022] 夸克显微镜 Quark Microscopy

Background

Translated from Nordic Olympiad in Informatics 2022 Quark Microscopy。If you find that the interaction library is broken, please contact the problem porter qvq。

1s,1G\texttt{1s,1G}

Problem Description

This is terrible! Niels’s beloved atom was hit by cosmic rays and split into many quarks. Niels urgently wants to find these quarks and then put them back together, so he asked you to help.

These NN quarks are located on a line segment of length 11 meter (101810^{18} ångström). Luckily, you have a very accurate but somewhat strange quark microscope that can detect and measure nearby quarks. However, due to quantum effects, it cannot directly tell you the position of the quark closest to the measurement point. Instead, it tells you the position of the second-closest quark to the measurement point, as well as how many quarks are tied for being the second-closest.

More precisely, you may perform a measurement at position xx on the line segment. For each measurement, the distances from each quark to xx are computed and sorted in nondecreasing order as d1,d2,,dNd_1,d_2,\cdots,d_N. You are given d2d_2, and the number of indices ii such that di=d2d_i=d_2 (which will only be 11 or 22). After making enough measurements, you need to output the position of every quark.

Each quark’s position is a positive integer in [1,1018][1,10^{18}] (unit: ångström), measured from the start of the segment. Due to the Pauli exclusion principle, no two quarks share the same position。

Input Format

Your program interacts with the interaction library through standard input and output.

The first line contains two positive integers N,TN,T, representing the number of quarks and the subtask number.

Then, your program starts interacting with the library:

  • ? x: Query the second-farthest quark from xx. The library returns two integers r,mr,m, where rr is the distance to the second-farthest quark, and mm is the number of quarks whose distance to xx equals rr (only 11 or 22). You must ensure 1018x2×1018-10^{18}\le x\le 2\times 10^{18}.

  • ! a1a_1 a2a_2 \cdots aNa_N: Output the quark positions. You may output these positions in any order. After answering, there should be no extra queries. You must ensure 1ai10181\le a_i\le 10^{18}.

Note: During interaction, you must flush the output buffer after each output.
Below are some common ways to flush the buffer in popular languages:

  • C++: fflush(stdout) or cout.flush()。In particular, printing a newline using std::endl also flushes the buffer.
  • C: fflush(stdout)

Output Format

See [Input Format].

3 3

6 1

4 1

1 2

? 5

? 15

? 11

! 11 10 12
3 1

2 1

1 2

2 1

45 1

? 1

? 2

? 3

? 47

! 1 3 92

Hint

Constraints

  • 3N1003\le N\le 100
  • 1T31\le T\le 3

Scoring

Subtask ID Score Restriction
11 40r40\cdot r There is a quark at position 11
22 All quark positions are even
33 20r20\cdot r No additional restrictions

Here rr is a constant. Let QQ be the maximum number of queries you make in a subtask. The value of rr is given in the table below:

Limit on QQ r=r=
Q>15000Q\gt 15\, 000 00
15000Q>560015\, 000\ge Q\gt 5\, 600 0.40.4
5600Q>35005\, 600\ge Q\gt 3\, 500 0.60.6
3500Q>24003\, 500\ge Q\gt 2\, 400 0.80.8
Q2400Q\le 2\, 400 1.01.0

To make local testing easier, we provide testing_tools.py, which can be downloaded from the attachments. For usage instructions, see the header of the file.

Translated by ChatGPT 5