QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 1024 MB 總分: 100

#1981. 安全距离

统计

过去的一年非常艰难,病毒在人群中传播。幸运的是,Alice 知道保持健康的关键之一是与他人保持安全距离。

Alice 目前身处一个封闭的房间内,该房间在二维平面上表示为一个宽为 $X$、高为 $Y$ 的矩形。房间内还有 $N$ 个人,已知他们的坐标 $(x_i, y_i)$。

我们将 Alice 和这 $N$ 个人视为二维平面上的点。Alice 的初始位置是 $(0, 0)$,她想要移动到位于 $(X, Y)$ 的出口。她可以在房间内向任意方向自由移动,但不能走出房间的边界。

求 Alice 从 $(0, 0)$ 移动到 $(X, Y)$ 的过程中,能够与其他人保持的最大安全距离。

输入格式

输入的第一行包含两个空格分隔的整数 $X$ 和 $Y$,其中 $X$ 是房间的宽度,$Y$ 是房间的高度。第二行包含一个整数 $N$,表示房间内的人数。接下来的 $N$ 行,每行包含两个浮点数 $x_i$ 和 $y_i$,表示房间内第 $i$ 个人的坐标。

输出格式

输出一个单一的浮点数 $d$,表示最大安全距离。

题目允许 $10^{-5}$ 的加性或乘性误差:如果 $d$ 是正确答案,那么任何在 $[d - 10^{-5}, d + 10^{-5}]$ 或 $[(1 - 10^{-5})d, (1 + 10^{-5})d]$ 范围内的数值均被接受。

数据范围

  • $1 \leqslant X, Y \leqslant 1\,000\,000$
  • $1 \leqslant N \leqslant 1\,000$
  • $0 \leqslant x_i \leqslant X$
  • $0 \leqslant y_i \leqslant Y$

样例

样例输入 1

8 6
3
3 1
3 5.5
6.5 1.5

样例输出 1

2.250000

说明

Alice 可以与其他人保持 $2.25$ 的距离,这是她能做到的最好结果。下图展示了一条可能的路径(绿色线条)。

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.