Magic

시간 제한3초메모리 제한1024 MB

요약
매 순간 일부 점이 사라지고 사라진 점의 번호가 이전 답에 따라 정해질 때, 남은 점들의 볼록 껍질 넓이의 두 배를 구한다.
난이도

어려움10점 중 8점

유형
기하, 동적 계획법, 이분 탐색
정답자
아직 제출이 없습니다

문제

There are nn clones of Little P on the plane. Define the area occupied by a group of instances as the smallest convex polygon that covers this group of instances. Little P has limited abilities, and some clones will disappear every moment. But before the next moment, Little P will use the magic technique to make these disappeared clones reappear in their original positions.

Given mm queries, after each moment when the clone disappears, what is the area occupied by the remaining clone?

입력

The first line of input contains two positive integers n,mn,m, describing the number of clones at the beginning and the total number of quries.

The next nn line, the ii line has two integers x_i,y_ix\_i, y\_i , describing the position of the iith clone.

In the next mm lines, the first integer kk in each line indicates that kk clones have disappeared at this moment. Next there are kk non-negative integers c_1,c_2,…,c_kc\_1, c\_2, \ldots, c\_k, which are used to generate the numbers of the disappeared clones.

Generated as follows:

Assume twice the area occupied by the avatar at the previous moment is SS. Then the numbers of the clones p_1,p_2,…,p_kp\_1, p\_2, \ldots , p\_k that disappeared at this moment are: p_i=\[(S+c_i) mod n]+1p\_i = \[(S + c\_i) \bmod n] + 1.

In particular, at the first moment, we believe that S=−1S = -1 in the previous moment, that is: the numbers of the clones p_1,p_2,…,p_kp\_1, p\_2, \ldots , p\_k that disappeared at the first moment are: p_i=\[(−1+c_i) mod n]+1p\_i = \[(-1 + c\_i) \bmod n] + 1.

출력

Output the mm lines sequentially in the order of the given time, each line is an integer, representing twice the area occupied by the remaining clones at that time.

제한

  • n≤105n \leq 10^5
  • m≤105m \leq 10^5
  • k≤100k \leq 100
  • ∣x_i∣,∣y_i∣≤108|x\_i|,|y\_i|\le 10^8;
  • No two clones have exactly the same coordinates;
  • k≤100k\le 100;
  • The sum of kk at all times does not exceed 2×1062\times 10^6;
  • 0≤c_i≤231−10\le c\_i\le 2^{31}-1;
  • Initially, all nn clones occupy an area greater than 00;
  • The set of vertices defining the region occupied by all nn clones is SS , ∣S∣≥3|S|\ge 3 . At any moment, there are at least two undisappeared clones in SS.

예제1

  1. 예제 1

    입력
    6 2
    -1 0
    -1 -1
    0 -1
    1 0
    0 1
    0 0
    3 1 3 6
    2 0 1
    
    예상 출력
    3
    2