QOJ.ac

QOJ

시간 제한: 1.0 s 메모리 제한: 512 MB 총점: 100 해킹 가능 ✓

#15168. 奥日与沃林深处

통계

在游戏《精灵与萤火意志》(Ori and the Will of the Wisps)中,森林正在枯萎。为了拯救这片破碎的土地,光之精灵奥日(Ori)必须踏上寻找精灵“森林之眼”(Eyes of the Forest)的旅程。

其中一个精灵在沃林深处(Mouldwood Depths)迷失了,那里对奥日来说太黑暗了。然而幸运的是,有一些移动的发光奇幻植物群,它们可以照亮一个圆形区域。

正式地讲,在 $xOy$ 平面上有 $n$ 组植物。第 $i$ 组植物可以照亮一个半径为 $r_i$ 的圆。为了方便起见,下文我们将用“第 $i$ 个圆”来指代这一区域。

所有圆都以恒定的速度沿直线运动。第 $i$ 个圆的圆心在时刻 $0$ 位于 $(Sx_i, Sy_i)$,并在时刻 $T$ 移动到 $(Tx_i, Ty_i)$。特别地,如果 $(Sx_i, Sy_i) = (Tx_i, Ty_i)$,则第 $i$ 个圆将一直保持在原地。

在时刻 $0$,奥日位于第 $1$ 个圆内,并希望在时刻 $T$ 之前移动到精灵所在的第 $n$ 个圆内。需要注意的是,由于奥日高超的跳跃技巧,他只需单次跳跃即可移动到任何地方,且跳跃是瞬间完成的。

现在,奥日决定选择一个合适的时间 $t$ ($0 \le t \le T$) 出发,并不间断地移动到第 $n$ 个圆,这意味着奥日也将在时刻 $t$ 移动到第 $n$ 个圆内。在此基础上,请最小化奥日在单次跳跃中需要在黑暗中度过的最大距离。请帮助奥日规划最佳路线。

输入格式

输入的第一行包含一个整数,表示 $n$ ($2 \le n \le 500$)。

输入的第 $i + 1$ ($1 \le i \le n$) 行包含五个整数,分别表示 $r_i, Sx_i, Sy_i, Tx_i, Ty_i$ ($1 \le r_i \le 10^9, -10^9 \le Sx_i, Sy_i, Tx_i, Ty_i \le 10^9$)。

输出格式

输出一行,包含一个实数,表示奥日在单次跳跃中需要在黑暗中度过的最大距离的最小值。

如果相对误差或绝对误差不超过 $10^{-6}$,您的答案将被接受。

样例

输入样例 1

2
1 0 0 2 2
1 3 4 7 2

输出样例 1

2.4721360

输入样例 2

3
2 0 0 0 0
3 0 -4 0 -104
3 -50 -54 50 -54

输出样例 2

26.2182541

说明

在第一个样例中,奥日将选择在时刻 $\frac{T}{2}$ 出发。

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.