Dynamic Convex Hull
题号:NC233187
时间限制:C/C++/Rust/Pascal 10秒,其他语言20秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

There are N points.

You will be given M queries. Each query will give you several points. You must answer the area of the convex hull of these points merged with the initial N points.

输入描述:

This problem contains multiple test cases.

The first line contains an integer T — the number of test cases.

For each test case:

The first line contains an integer N — the number of the initial points.

Then N lines follow. The i-th of them contains two integers — the coordinate of the i-th initial point.

The next line contains an integer M — the number of queries.

Then M queries follow. For each query: the first line contains an integer — the number of points in this query; then k lines follow, the i-th of which contains two integers — the coordinate of the i-th point in this query.

It is guaranteed that in all test cases, the sum of N is no more than , and the sum of k is no more than .

输出描述:

For each query in each test case, output in one line. S indicates the area in this query.

It can be proved that is always an integer.

示例1

输入

复制
1
8
-1 2
-2 1
-2 -1
-1 -2
1 -2
2 -1
2 1
1 2
1
3
0 3
0 4
1 5

输出

复制
39