QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 256 MB 总分: 100

#11778. 基站选址

统计

5G 是继当前 4G 标准之后提出的下一代电信标准。5G 规划旨在实现比当前 4G 更高的容量,允许更高密度的移动宽带用户,并支持设备到设备、可靠且大规模的无线通信。一家电信公司希望安装更多的基站,以便为客户提供更好的通信服务。由于安装成本和可用位置的限制,该公司只能在 $L$ ($2 \le L \le 100,000$) 个候选位置中安装 $S$ ($2 \le S \le L$) 个基站。由于基站工作在相同的频段,它们会产生干扰并导致严重的性能下降。为了给客户提供高质量的通信体验,该公司希望最大化基站之间的距离,以减少基站间的无线干扰。假设 $L$ 个候选位置位于一条直线上,坐标分别为 $P_1, P_2, \dots, P_L$ ($0 \le P_i \le 1,000,000$),且公司想要在这些候选位置中安装 $S$ 个基站。请问这 $S$ 个基站之间的最小距离的最大值是多少?

输入格式

输入数据包含多组测试用例。 每组测试用例的第一行包含 $L$(即候选位置的数量)和 $S$(即基站的数量)。下一行包含 $L$ 个由空格分隔的整数,表示 $P_1, P_2, \dots, P_L$。 输入数据以 “0 0” 结束。

输出格式

对于每组测试用例,输出一行,表示基站之间的最小距离的最大值。

样例

样例输入 1

5 3
2 3 9 6 11
4 3
1 4 9 10
0 0

样例输出 1

4
3

说明

对于第一组测试用例,3 个基站可以安装在位置 2, 6, 11。

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.