Hide

Problem E
Mineral deposits

Languages da de en et fi lt lv pl uk
/problems/boi23.mineraldeposits/file/statement/en/img-0001.jpg
Eroding mud face exposing new minerals. Photo: Michael D. Turnbull, licence: CC BY-SA.

You handle signal processing for an extra-terrestrial mining company, and your vessel is currently approaching an asteroid. Preliminary scans show the presence of k mineral deposits on the asteroid, but their precise locations are unknown.

The surface of the asteroid can be seen as a grid of integer coordinates. Each of the mineral deposits is located at unknown integer coordinates such that the ith deposit has coordinates (xi,yi) with bxib and byib for some integer b corresponding to the size of your initial scan.

To determine the precise locations of the mineral deposits, you may send probes to the surface of the asteroid. The probes are sent out in waves of several probes at once.

Say you sent a wave of d probes to the surface at coordinates (sj,tj) for 1jd. When a probe arrives at its coordinates, it determines the Manhattan distances to each of the k mineral deposits and sends the distances back to the ship. All data packets arrive at the same time, and it is not possible to determine which probes returned which distances. Thus the wave returns the kd integer distances

|xisj|+|yitj|for all i{1,,k} and j{1,,d}.

You need to minimise the number of waves of probes that is sent to the surface.

Interaction

This is an interactive problem. Interaction begins with you reading a single line containing three integers b, k, and w: the grid’s boundary b, the number k of mineral deposits, and the maximum number w of waves you may send.

You then ask at most w queries, each corresponding to a wave. A query consists of ? followed by 2d integers separated by space, such as “? s1 t1 sd td”, where the number d of probes in this wave must satisfy 1d2000. The values (si,ti) are interpreted as the coordinates of the ith probe and must satisfy 108si108 and 108ti108. The response is a single line with kd integers in non-decreasing order: the Manhattan distances between all pairs of mineral deposits and probe coordinates. The total number of probes across all waves may not exceed 2104.

Interaction ends with you printing a single line consisting of ! followed by k points x1,y1,x2,y2,xk,yk, separated by space. This must be your last line of output.

Your submission is considered correct if you print all locations of the mineral deposits. You may print them in any order.

Constraints and Scoring

We always have 1b108, 1k20, and 2w104.

Your solution will be tested on a set of test groups, each worth a number of points. Each test group contains a set of test cases. To get the points for a test group you need to solve all test cases in the test group. Your final score will be the maximum score of a single submission.

Group

Points

Constraints

1

16

k=1,w=104

2

19

w500

3

11

w210

4

13

w130

5

14

w3, b104

6

14

w3, b107

7

13

No further constraints

Example

\includegraphics[width=.6\textwidth ]{img/sample1.pdf}

In this example, there are k=2 mineral deposits at positions (1,2) and (3,2), shown as red stars. In the first wave, you might send d=3 probes to (4,3), (1,0), and (2,1), shown as black dots. This wave would return the 6 distances

2,4,4,4,6,10.

In the next wave, you might send d=2 probes to (1,2) and (0,2). This wave would return the 4 distances

0,3,5,8.
Read Sample Interaction 1 Write
 4 2 10
 ? -4 -3 -1 0 2 -1
 2 4 4 4 6 10
 ? 1 2 0 -2
 0 3 5 8
 ! 1 2 -3 -2
Hide

Please log in to submit a solution to this problem

Log in