PivotOJ

Mineral deposits

시간 제한: 2000ms메모리 제한: 1024MB출처: BOI 2023BOJ 31978

문제

You handle signal processing for an extra-terrestrial mining company, and your vessel is currently approaching an asteroid. Preliminary scans show the presence of kk 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 iith deposit has coordinates (xi,yi)(x_i, y_i) with bxib-b \le x_i \le b and byib-b\le y_i \le b for some integer bb 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 dd probes to the surface at coordinates (sj,tj)(s_j,t_j) for 1jd1\leq j\leq d. When a probe arrives at its coordinates, it determines the Manhattan distances to each of the kk 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 kdk\cdot d integer distances \[|x_i-s_j| + |y_i - t_j| \qquad\text{for all } i \in \{1,\ldots,k\} \text{ and } j \in\{ 1,\ldots,d\}\,.\]

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

예제

예제 1

입력
4 2 10

2 4 4 4 6 10

0 3 5 8
출력
? -4 -3 -1 0 2 -1

? 1 2 0 -2

! 1 2 -3 -2
코드를 제출하려면 로그인하세요.