“Clone Technique!” — Little P
There are $n$ clones of Little P on a plane. The region occupied by a set of clones is defined as the smallest convex polygon that covers this set of clones. Little P has limited power; at each moment, several clones disappear. However, before the next moment, Little P will use the “Clone Technique!” to make these disappeared clones reappear at their original positions. Little P wants to know: after the clones disappear at each moment, what is the area of the region occupied by the remaining clones?
Input
The input is read from the file phantom.in.
The first line contains two positive integers $n$ and $m$, representing the initial number of clones and the total number of moments, respectively.
The next $n$ lines each contain two integers $x_i, y_i$, describing the position of the $i$-th clone.
The next $m$ lines each start with an integer $k$, representing that $k$ clones disappear at this moment. This is followed by $k$ non-negative integers $c_1, c_2, \dots, c_k$, used to generate the indices of the disappeared clones.
The generation method is as follows: Let $S$ be twice the area of the region occupied by the clones in the previous moment. Then the indices $p_1, p_2, \dots, p_k$ of the clones that disappear at this moment are: $$p_i = [(S + c_i) \pmod n] + 1$$ Specifically, at the first moment, we consider the previous moment's $S = -1$. That is, the indices of the clones $p_1, p_2, \dots, p_k$ that disappear at the first moment are: $$p_i = [(-1 + c_i) \pmod n] + 1$$
Output
The output is written to the file phantom.out.
Output $m$ lines in the order of the given moments, each containing an integer representing twice the area of the region occupied by the remaining clones at that moment.
Examples
Input 1
6 2 -1 0 -1 -1 0 -1 1 0 0 1 0 0 3 1 3 6 2 0 1
Output 1
3 2
Examples 2, 3, 4
See phantom/phantom2.in and phantom/phantom2.ans, phantom/phantom3.in and phantom/phantom3.ans, and phantom/phantom4.in and phantom/phantom4.ans in the contestant's directory.
Note
As shown in the figure below: the left image shows the positions of the 6 input clones and the region they occupy; the middle image shows the situation at the first moment, where the disappeared clones have indices 1, 3, and 6, and the remaining 3 points occupy the region inside the solid lines, with twice the area being 3; the right image shows the situation at the second moment, where the disappeared clones have indices: $$[(0 + 3) \pmod 6] + 1 = 4$$ $$[(1 + 3) \pmod 6] + 1 = 5$$ The remaining 4 points occupy the region inside the solid lines.
Subtasks
| Test Case ID | $n \le$ | $m \le$ | $k$ |
|---|---|---|---|
| 1 | 10 | 10 | $\le n - 3$ |
| 2 | 1000 | 1000 | $\le n - 3$ |
| 3 | 1000 | 1000 | $\le n - 3$ |
| 4 | 1000 | 1000 | $\le n - 3$ |
| 5 | 100000 | 100000 | $=1$ |
| 6 | 100000 | 100000 | $=1$ |
| 7 | 100000 | 100000 | $=1$ |
| 8 | 100000 | 100000 | $=1$ |
| 9 | 100000 | 100000 | $=2$ |
| 10 | 100000 | 100000 | $=2$ |
| 11 | 100000 | 100000 | $\le 3$ |
| 12 | 100000 | 100000 | $\le 5$ |
| 13 | 100000 | 100000 | $\le 9$ |
| 14 | 100000 | 100000 | $\le 12$ |
| 15 | 100000 | 100000 | $\le 20$ |
| 16 | 100000 | 100000 | $\le 100$ |
| 17 | 100000 | 100000 | $\le 100$ |
| 18 | 100000 | 100000 | $\le 100$ |
| 19 | 100000 | 100000 | $\le 100$ |
| 20 | 100000 | 100000 | $\le 100$ |
For all data, it is guaranteed that: $|x_i|, |y_i| \le 10^8$; No two clones have the exact same coordinates; $k \le 100$; The sum of $k$ over all moments does not exceed $2 \times 10^6$; $0 \le c_i \le 2^{31} - 1$; Initially, the area of the region occupied by all $n$ clones is greater than 0; * Define the set of vertices of the region occupied by all $n$ clones as $S$, $|S| \ge 3$. At any moment, there are at least two non-disappeared clones in $S$.