#P14802. [CCPC 2024 哈尔滨站] 凹包

    ID: 14699 远端评测题 1000ms 1024MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>计算几何2024凸包旋转卡壳CCPC哈尔滨

[CCPC 2024 哈尔滨站] 凹包

Description

A simple polygon is a closed curve in the Euclidean plane consisting of straight line segments meeting end-to-end. Two line segments meet at every endpoint, and there are no other points of intersection between the line segments.

Simple polygons can be categorized into two types: convex and concave. A convex polygon is defined as a polygon where, for any two points inside it, all points on the line segment between these two points also lie inside the polygon, either within its interior or on its boundary. A simple polygon that is not convex is called a concave polygon. As shown in the figure below, the left one is a convex polygon, while the right one is a concave polygon.

:::align{center} :::

Now, given nn points such that all points are distinct and no three points are collinear, your task is to select some of these nn points (maybe all of them) and connect them in any order to form a concave polygon\textbf{concave polygon} with a strictly positive area. You need to determine the maximum possible area of the concave polygon that can be formed.

Input Format

The first line contains an integer TT (1T1041\le T \le 10^4), indicating the number of test cases.

For each test case, the first line contains a positive integer nn (3n1053\le n \le 10^5), indicating the number of points.

The next nn lines each contain two integers xi,yix_i, y_i (109xi,yi109-10^9 \le x_i,y_i \le 10^9), representing the coordinates of each point. It is guaranteed that all points are distinct, and no three points are collinear.

The sum of nn over all test cases does not exceed 21052\cdot 10^5.

Output Format

For each test case, if it is not possible to form a concave polygon with a strictly positive area, output 1-1; otherwise, output a positive integer representing twice the maximum area of the concave polygon that can be formed. It can be proven that this answer is always a positive integer.

2
6
-2 0
1 -2
5 2
0 4
1 2
3 1
4
0 0
1 0
0 1
1 1
40
-1