QOJ.ac

QOJ

Límite de tiempo: 3 s Límite de memoria: 64 MB Puntuación total: 100

#17234. 天线

Estadísticas

一家电信公司正在 Vrsar 市建设 GSM 网络。他们与该市签订的合同规定了信号需要覆盖的最少住户数量。由于预算限制,他们只能建造一个具有特定覆盖半径的发射天线。由于成本与天线的覆盖半径成正比,他们希望合理放置天线,使得满足合同条款所需的覆盖半径最小。

Vrsar 市有 $N$ 个住户,每个住户由一对整数坐标表示。天线可以放置在平面上的任意点(不一定是整数坐标),天线的覆盖半径可以是任何正实数。如果天线的覆盖半径为 $R$,那么当住户与天线之间的距离不超过 $R$ 时,该住户就被信号覆盖。

编写一个程序,给定住户的位置和整数 $K$,求出覆盖至少 $K$ 个住户所需的最小半径,以及天线的一个可能位置。

输入格式

输入的第一行包含两个整数 $N$ 和 $K$ ($2 \le K \le N \le 500$) —— 住户的总数和需要被信号覆盖的最少住户数量。

接下来的 $N$ 行,每行包含两个整数 $X$ 和 $Y$ ($0 \le X, Y \le 10\,000$) —— 一个住户的坐标。没有两个住户会位于相同的坐标。

输出格式

第一行应包含天线所需的最小半径 $R$ —— 一个实数。

第二行应包含天线的坐标 —— 两个实数 $X$ 和 $Y$。

说明:如果存在多个解,你可以输出其中任意一个。这三个数字都应以标准十进制形式或科学计数法输出。

子任务

你的解法被判定为正确,当且仅当满足以下两个条件:

  • 你的输出 $R$ 与裁判确定的最小所需半径之间的绝对误差不超过 $0.0001$。
  • 将半径为 $R + 0.0002$ 的天线放置在坐标 $(X, Y)$ 处时,能够覆盖至少 $K$ 个住户。

样例

输入 1

4 3
2 2
6 2
6 5
2 8

输出 1

2.5
4 3.5

输入 2

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

输出 2

2.236068
3 4

说明

每个插图描绘了相应的输入以及所提供的解。

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.