QOJ.ac

QOJ

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

#12552. 青蛙过河

الإحصائيات

Fiona 设计了一款名为 Froggy Ford 的新电脑游戏。在这个游戏中,玩家需要帮助一只青蛙利用河中的石头过河。青蛙从河岸跳到第一块石头上,然后跳到第二块,以此类推,直到到达对岸。不幸的是,这只青蛙非常虚弱,其跳跃距离相当有限。因此,玩家需要选择一条最优路径——即能使穿越路径所需的最大跳跃距离最小化的路径。

最优路径

添加石头后的最优路径

Fiona 认为这个游戏挑战性不足,因此她计划增加一个在河中放置一块新石头的功能。她请求你编写一个程序,确定这块新石头的位置,使得穿越最优路径所需的最大跳跃距离最小化。

输入格式

输入文件的第一行包含两个整数 $w$ —— 河的宽度,以及 $n$ —— 河中石头的数量 ($1 \le w \le 10^9, 0 \le n \le 1000$)。

接下来的 $n$ 行,每行包含两个整数 $x_i, y_i$ —— 石头的坐标 ($0 < x_i < w, -10^9 \le y_i \le 10^9$)。所有石头的坐标各不相同。

河岸的坐标分别为 $x = 0$ 和 $x = w$。

输出格式

输出两个实数 $x_+$ 和 $y_+$ ($0 < x_+ < w, -10^9 \le y_+ \le 10^9$) —— 所添加石头的坐标。这块石头应使穿越最优路径所需的最大跳跃距离最小化。如果添加新石头无法改善最优路径,则可以输出满足约束条件的任意一对 $x_+$ 和 $y_+$,甚至可以与现有的一块石头重合。

你的答案应精确到小数点后三位。

样例

输入 1

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

输出 1

4.5 4.5

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.