QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#4518. 电缆连接 / 工业建筑

الإحصائيات

两条笔直的道路 $A$ 和 $B$ 在公共交叉点处垂直相交。道路 $A$ 向东延伸,道路 $B$ 向北延伸。

这些道路是该地区正在建设的大型工业系统的一部分,它们应该通过一条特殊的高频电缆连接起来。遗憾的是,连接不能直接在交叉点处建立。此外,在道路交汇处的场地角落里还有一些建筑物。这些建筑物构成了电缆的障碍物。

经过多次协商并考虑了各种技术限制后,电缆公司的分析师根据障碍物确定了一组关键点。随后他们建议,电缆应以满足以下标准的方式连接两条道路:

  • 电缆应沿直线铺设。
  • 电缆不应穿过任何关键点与道路交叉点处的场地角落之间的区域。
  • 电缆的长度应尽可能短。

现在,你的任务是确定电缆的长度。

输入格式

输入包含多个测试用例。每个测试用例的第一行包含一个整数 $N$ ($1 \le N \le 10^6$),表示关键点的数量。接下来有 $N$ 行,每行描述一个点。点 $P$ 由两个空格分隔的整数 $a, b$ ($1 \le a, b \le 10\,000$) 表示。整数 $a$ 是点 $P$ 到道路 $A$ 的距离,整数 $b$ 是点 $P$ 到道路 $B$ 的距离。所有距离单位均为米。你可以假设道路的长度和场地的大小都是无限的。每个测试用例中的所有坐标对 $(a, b)$ 都是唯一的。

输出格式

对于每个测试用例,输出一行,包含一个浮点数 $L$,表示电缆的最小可能长度(单位为米)。$L$ 的输出误差应不超过 $10^{-3}$。

样例

输入格式 1

7
5 1
9 1
6 2
1 3
8 4
4 5
2 8

输出格式 1

16.648

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.