#P3827. [NOI2017] 分身术

[NOI2017] 分身术

Description

"Clone! Technique!" — Xiao P.

On a plane, there are nn clones of Xiao P. Define the region occupied by a set of clones as the smallest convex polygon that covers this set of clones (i.e., the convex hull). Xiao P's ability is limited: at each time step, several clones will disappear. However, before the next time step, Xiao P will use the Clone Technique to make these disappeared clones reappear at their original positions.

Xiao P wants to know the area of the region occupied by the remaining clones after the disappearances at each time step.

Constraints

  • xi,yi108|x_i|, |y_i| \le 10^8.
  • No two clones share exactly the same coordinates.
  • k100k \le 100.
  • The sum of kk over all time steps does not exceed 2×1062 \times 10^6.
  • 0ci23110 \le c_i \le 2^{31} - 1.
  • Initially, the area occupied by all nn clones is greater than 00.
  • Define the vertex set of the region occupied by all nn clones as SS, with S3|S| \ge 3. At any time step, there exist at least two clones from SS that have not disappeared.
Test point ID nn \leq mm \leq kk
11 1010 n3\leq n-3
22 10310^3
33
44
55 10510^5 =1=1
66
77
88
99 =2=2
1010
1111 3\leq 3
1212 5\leq 5
1313 9\leq 9
1414 12\leq 12
1515 20\leq 20
1616 100\leq 100
1717
1818
1919
2020

Input Format

The first line contains two positive integers n,mn, m, denoting the initial number of clones and the total number of time steps.

The next nn lines each contain two integers xi,yix_i, y_i, describing the position of the ii-th clone.

The next mm lines: on each line, the first integer kk indicates that kk clones disappear at this time step. Then there are kk non-negative integers c1,c2,,ckc_1, c_2, \ldots, c_k, used to generate the indices of the disappearing clones.

Generation method:

Let SS be twice the area of the region occupied by the clones at the previous time step. Then the indices of the clones that disappear at this time step, p1,p2,,pkp_1, p_2, \ldots , p_k, are: pi=[(S+ci)modn]+1p_i = [(S + c_i) \bmod n] + 1.

In particular, at the first time step we assume S=1S = -1, i.e., the indices of the clones that disappear at the first time step, p1,p2,,pkp_1, p_2, \ldots , p_k, are: pi=[(1+ci)modn]+1p_i = [(−1 + c_i) \bmod n] + 1.

Output Format

Output mm lines in the order of the time steps. Each line contains one integer: twice the area of the region occupied by the remaining clones at that time step.

6 2
-1 0
-1 -1
0 -1
1 0
0 1
0 0
3 1 3 6
2 0 1

3
2

Hint

Sample explanation:

As shown in the figure: the left figure shows the positions of the 66 clones and the region they occupy; the middle figure shows the situation at the first time step, where the indices of the disappearing clones are 1,3,61, 3, 6. The remaining 33 points occupy the region inside the solid lines in the figure, and twice the area is 33. The right figure shows the situation at the second time step, where the indices of the disappearing clones are

[(0+3)mod6]+1=4[(0 + 3)\bmod 6] + 1 = 4

[(1+3)mod6]+1=5[(1 + 3)\bmod 6] + 1 = 5

The remaining 44 points occupy the region inside the solid lines in the figure.

Translated by ChatGPT 5