QOJ.ac

QOJ

Límite de tiempo: 2.0 s Límite de memoria: 512 MB Puntuación total: 100 Hackeable ✓

#15204. Ori and Mouldwood Depths

Estadísticas

在游戏《精灵与萤火意志》(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$ 个圆(即奥日到达第 $n$ 个圆的时刻同样为 $t$)。在此基础上,最小化奥日在单次跳跃中需要在黑暗中度过的最大距离。请帮助奥日规划最佳路线。

输入格式

输入的第一行包含一个整数,表示 $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.