QOJ.ac

QOJ

Límite de tiempo: 10 s Límite de memoria: 512 MB Puntuación total: 100

#3285. 使凸包周长最短

Estadísticas

对于包含三个或更多平面点的集合,若并非所有点都在同一条直线上,其凸包是指包含该集合中所有点(位于边界或内部)的面积最小的凸多边形。给定一组点的坐标,你的任务是计算:从集合中剔除两个点后,凸包周长最多能缩短多少。

下图对应样例 1 到 3 的三种情况。被圈出的点是被剔除的点,粗虚线表示剔除后形成的周长最短的凸包。

样例 1、2 和 3 的示意图

输入格式

输入包含一组测试数据,格式如下:

$n$ $x_1 \ y_1$ $\vdots$ $x_n \ y_n$

其中,$n$ 是集合中点的数量,满足 $5 \le n \le 10^5$。对于每个 $i$,$(x_i, y_i)$ 给出了集合中第 $i$ 个点的坐标。$x_i$ 和 $y_i$ 是介于 $-10^6$ 到 $10^6$ 之间的整数。集合中的所有点都是不同的,即当 $j \neq k$ 时,$x_j \neq x_k$ 或 $y_j \neq y_k$。保证集合中没有超过 $n-2$ 个点共线。

输出格式

输出原始集合的凸包周长与剔除两个点后得到的凸包周长中的最小值之差。输出误差不应超过 $10^{-4}$。

样例

输入格式 1

10
-53 62
-19 58
-11 11
-9 -22
45 -7
37 -39
47 -58
-2 41
-37 10
13 42

输出格式 1

72.96316928

输入格式 2

10
-53 62
-19 58
-11 11
-9 -22
45 -7
43 -47
47 -58
-2 41
-37 10
13 42

输出格式 2

62.62947992

输入格式 3

10
-53 62
-35 47
-11 11
-9 -22
45 -7
43 -47
47 -58
-2 41
-37 10
13 42

输出格式 3

61.58166534

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#302EditorialOpen题解jiangly2025-12-14 06:59:52View

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.