#P9568. [SDCPC2023] Computational Geometry
[SDCPC2023] Computational Geometry
题目描述
Given a convex polygon with vertices, you need to choose three vertices of , denoted as , and in counter-clockwise order. There must be exactly edges from to in counter-clockwise order (that is to say, is not an endpoint of these edges).
Consider cutting through with segment and . Let be the polygon consisting of , and the edges between and . It's easy to see that this polygon has edges.
Find the maximum possible area of .
Note that and can overlap with edges of .
输入格式
There are multiple test cases. The first line of the input contains an integer indicating the number of test cases. For each test case:
The first line contains two integers and (, ) indicating the number of vertices of the convex polygon and the number of edges from to in counter-clockwise order.
For the following lines, the -th line contains two integers and () indicating the and coordinate of the -th vertex of the convex polygon . Vertices are given in counter-clockwise order. It's guaranteed that the area of the convex polygon is positive, and there are no two vertices with the same coordinate. It's possible that three vertices lie on the same line.
It's guaranteed that the sum of of all test cases will not exceed .
输出格式
For each test case output one line containing one real number indicating the maximum possible area of . Your answer will be considered correct if its relative or absolute error is less than .
题目大意
【题目描述】
给定一个有 个顶点的凸多边形 ,您需要选择 的三个顶点,按逆时针顺序记为 , 和 。要求在 沿逆时针方向到 之间恰有 条边(也就是说, 不是这 条边的端点)。
考虑用线段 和 将 割开。将由线段 ,,以及 和 之间的 条边围成的 边形记作 。
求 可能的最大面积。
注意, 和 可以与 的边重合。
【输入格式】
有多组测试数据。第一行输入一个整数 表示测试数据组数。对于每组测试数据:
第一行输入两个整数 和 (,),表示凸多边形 的顶点数和 沿逆时针方向到 之间的边数。
对于接下来的 行,第 行输入两个整数 和 (),表示凸多边形 第 个顶点的 坐标和 坐标。顶点按逆时针顺序给出。保证凸多边形的面积为正,且没有顶点会重合。可能存在三个顶点位于同一条直线上的情况。
保证所有数据 之和不超过 。
【输出格式】
每组数据输出一行一个实数表示 的最大可能面积。只要您的答案的相对误差或绝对误差小于 即视为正确。
【样例解释】
对于第一组样例数据, 就是整个三角形,面积为 .
第二和第三组样例数据解释如下。
3
3 1
0 0
1 0
0 1
8 3
1 2
3 1
5 1
7 3
8 6
5 8
3 7
1 5
7 2
3 6
1 1
3 1
7 1
8 1
5 6
4 6
0.500000000000
26.500000000000
20.000000000000
提示
For the first sample test case, is the whole triangle. Its area is .
The second and third sample test case are shown below.