#P9702. [GDCPC2023] Computational Geometry
[GDCPC2023] Computational Geometry
题目描述
Given a convex polygon with vertices, you need to choose two vertices of , so that the line connecting the two vertices will split into two smaller polygons and , both with positive area.
Let be the diameter of polygon and be the diameter of polygon , calculate the minimum value of .
Recall that the diameter of a polygon is the maximum distance between two points inside or on the border of the polygon.
输入格式
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 an integer () indicating the number of vertices of the convex polygon .
For the following lines, the -th line contains two integers and () indicating 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 integer indicating the answer.
题目大意
【题目描述】
给定一个有 个顶点的凸多边形 ,您需要选择 的两个顶点,并用一条同时穿过这两个顶点的直线,将 分成两个面积均为正数的小多边形 和 。
记 表示多边形 的直径, 表示多边形 的直径,求 的最小值。
请回忆:一个多边形的直径,指的是该多边形内部或边界上任意两点之间的距离的最大值。
【输入格式】
有多组测试数据。第一行输入一个整数 表示测试数据组数。对于每组测试数据:
第一行输入一个整数 ()表示凸多边形 的顶点数量。
对于接下来 行,第 行输入两个整数 和 (),表示凸多边形 的第 个顶点。顶点按逆时针顺序给出。保证该凸多边形面积为正,且没有顶点会重合。可能存在三个顶点位于同一条直线上的情况。
保证所有数据 之和不超过 。
【输出格式】
每组数据输出一行一个整数表示答案。
【样例解释】
第一组样例数据如下图所示。小多边形的直径用红色虚线标出。事实上,顶点 和 是这一组数据中唯一能选择的一对顶点。您不能选择顶点 和 ,或顶点 和 ,因为它们无法将 分成两个面积均为正数的小多边形。
第二组样例数据如下图所示。小多边形的直径用红色虚线标出。
2
4
1 0
2 0
1 1
0 0
6
10 4
9 7
5 7
4 5
6 4
9 3
4
44
提示
The first sample test case is shown as follows. The diameter of smaller polygons are marked by red dashed segments. In fact, and are the only pair of vertices we can choose in this test case. You can't choose and , or and , because they can't split into two smaller polygons both with positive area.
The second sample test case is shown as follows. The diameter of smaller polygons are marked by red dashed segments.