Under construction

Still being built. Things may change

Magic

Time limit3sMemory limit1024 MB

Summary
Each round deletes some points (indices decoded from the previous answer). Print twice the convex hull area of the remaining points each round.
Level

Hard9 of 10

Topics
Geometry, Divide and conquer, Sorting
Solved
No attempts yet

Statement

There are nn clones of Little P on the plane. The area occupied by a group of clones is the area of the smallest convex polygon that covers the group. Little P has limited abilities, so some clones disappear at each moment. Before the next moment, Little P uses a magic technique to make the disappeared clones reappear at their original positions.

Given mm queries, find the area occupied by the remaining clones after each moment when clones disappear.

Input

The first line contains two positive integers nn and mm, the number of clones at the beginning and the total number of queries.

The next nn lines contain two integers xix_i and yiy_i each, the position of the ii-th clone.

Each of the next mm lines starts with an integer kk, meaning kk clones disappear at this moment. It is followed by kk non-negative integers c1,c2,…,ckc_1, c_2, \ldots, c_k, which are used to generate the numbers of the disappeared clones.

Let SS be twice the area occupied by the remaining clones at the previous moment. The numbers of the clones that disappear at this moment are pi=((S+ci) mod n)+1p_i = ((S + c_i) \bmod n) + 1. At the first moment, take S=−1S = -1, so pi=((−1+ci) mod n)+1p_i = ((-1 + c_i) \bmod n) + 1.

Output

For each of the mm moments, in the given order, print one integer on its own line: twice the area occupied by the clones that remain at that moment.

Constraints

  • n≤105n \leq 10^5
  • m≤105m \leq 10^5
  • k≤100k \leq 100
  • ∣xi∣,∣yi∣≤108|x_i|, |y_i| \leq 10^8
  • No two clones have the same coordinates.
  • The sum of kk over all moments does not exceed 2×1062 \times 10^6.
  • 0≤ci≤231−10 \leq c_i \leq 2^{31} - 1
  • Initially, all nn clones occupy an area greater than 00.
  • The set of vertices that define the region occupied by all nn clones is SS, with ∣S∣≥3|S| \geq 3. At any moment, at least two clones in SS have not disappeared.

Examples1

  1. Example 1

    Input
    6 2
    -1 0
    -1 -1
    0 -1
    1 0
    0 1
    0 0
    3 1 3 6
    2 0 1
    
    Expected output
    3
    2