#P10859. [HBCPC2024] Nana Likes Polygons

[HBCPC2024] Nana Likes Polygons

题目描述

Nana’s electronic pet, MACARON, enjoys moving around in the room. Nana wants to create a boundedarea where MACARON can roam within.

The positions in the room can be represented using a two-dimensional coordinate system, and Nana provides a set of vertices on it. Nana likes polygons and now wants to select a subset of vertices that can form a convex polygon as its endpoints. However, Nana also wants to ensure that the selected area is not too big.

Thus, she is going to determine the minimum possible area of the convex polygon ending on a subset of given vertices. If such a convex polygon doesn’t exist, please output -1 (without quotes).

输入格式

The first line contains a single integer T(1T10)T (1 \leq T \leq 10) — the number of test cases.

For each test case, the first line contains a single integer n(1n100)n (1 \leq n \leq 100) — the number of given vertices.

The following nn lines each contain two integers, and the ii-th line contains xi,yi(1000xi,yi1000)x_i, y_i (-1000 \leq x_i, y_i \leq 1000) — the coordinate of the ii-th vertex.

输出格式

For each test case, if no such convex polygon, please output -1 without quotes; otherwise output a single real number denoting the minimum possible area of the convex polygon ending on these given vertices.

Let aa and bb denote the answer and your output respectively. Your output will be accepted if the absolute or relative error of bb does not exceed 10610^{-6}. Formally, your output is accepted if and only if abmax(a,b)106\dfrac{|a-b|}{\max(a,b)} \leq 10^{-6}

2
4
0 -1
-3 0
0 2
2 2
3
-1 -1
0 0
1 1
2
-1

提示

For the first test case, choose (2,2),(3,0)(2, 2), (−3, 0), and (0,2)(0, 2) as endpoints of a convex polygon with area 22. It can be proved that this is the minimized area in this case.

For the second test case, no convex polygon can be formed by these three vertices.