CF780H.Intranet of Buses
NOI/NOI+/CTSC
通过率:0%
时间限制:10.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A new bus route is opened in the city
. The route is a closed polygon line in the place, with all segments parallel to one of the axes. m buses will operate on the route. All buses move in a loop along the route in the same direction with equal constant velocities (stopping times are negligible in this problem).
Buses start their movement in the first vertex of the route with equal interval. Suppose that T is the total time for a single bus to travel the whole loop of the route. Then, the bus 1 starts moving at time 0, the bus 2 starts at time T / m, the bus 3 starts at time 2_T_ / m, and so on; finally, the bus m starts moving at time (m - 1)T / m. Thus, all intervals between pairs of consecutive buses (including the interval between the last and the first bus) are equal.
Buses can communicate with each other via wireless transmitters of equal power. If the transmitters have power D, then only buses within distance D of each other can communicate.
The buses are also equipped with a distributed system of schedule tracking. For all buses to stick to the schedule, the system has to synchronize the necessary data between all buses from time to time. At the moment of synchronization, the bus 1 communicates with the bus 2, the bus 2 — with bus 3, and so on; also, the bus m communicates with the bus 1.
As a research employee, you are tasked with finding the smallest value of D such that it is possible to find a time moment to perform synchronization once all buses have started moving.
一条新的公交线路在城市中开通了!。该线路在平面上构成一条闭合的折线,且所有线段均平行于坐标轴之一。共有 m 辆公交车在该线路上运行。所有公交车均以相同的恒定速度、沿同一方向在该环形线路上循环行驶(本题中忽略停靠时间)。
各公交车从路线的第一个顶点出发,出发时间间隔相等。设单辆公交车完整绕行一圈所需总时间为 T,则公交车 1 在时刻 0 出发,公交车 2 在时刻 T/m 出发,公交车 3 在时刻 2T/m 出发,依此类推;最终,公交车 m 在时刻 (m−1)T/m 出发。因此,任意两辆相邻公交车(包括最后一辆与第一辆之间)的时间间隔均相等。
公交车之间可通过功率相同的无线发射器互相通信。若发射器功率为 D,则仅当两辆公交车之间的距离不超过 D 时,它们才能通信。
此外,公交车还配备了一套用于跟踪时刻表的分布式系统。为确保所有公交车严格遵守时刻表,该系统需不时地在所有公交车之间同步必要数据。在一次同步时刻,公交车 1 与公交车 2 通信,公交车 2 与公交车 3 通信,……,公交车 m 与公交车 1 通信。
作为一名科研人员,你的任务是:求出最小的 D 值,使得存在某个时刻(所有公交车均已开始运行后),能够完成上述同步操作。
输入格式
The first line contains two integers n and m (2 ≤ n, m ≤ 105) — the number of vertices of the polygonal line, and the number of buses respectively.
Next n lines describe the vertices of the route in the traversing order. Each of these lines contains two integers x__i, y__i ( - 1000 ≤ x__i, y__i ≤ 1000) — coordinates of respective vertex.
It is guaranteed that each leg of the route (including the leg between the last and the first vertex) is paralles to one of the coordinate axes. Moreover, no two subsequent vertices of the route coincide. The route is allowed to have self-intersections, and travel along the same segment multiple times.
第一行包含两个整数 n 和 m(2≤n,m≤105)—— 分别表示折线的顶点数和公交车数量。
接下来的 n 行按遍历顺序描述路线的各个顶点。每行包含两个整数 xi、yi(−1000≤xi,yi≤1000)—— 表示对应顶点的坐标。
保证路线的每一段(包括最后一个顶点与第一个顶点之间的线段)均平行于某一条坐标轴。此外,路线中任意两个相邻顶点均不重合。路线允许自相交,也允许多次经过同一段线段。
输出格式
Print one real number — the answer to the problem. Your answer will be accepted if the relative or the absolute error doesn't exceed 10 - 6.
输出一个实数——该问题的答案。只要你的答案的相对误差或绝对误差不超过 10−6,即视为正确。
输入输出样例
输入#1
4 2 0 0 0 1 1 1 1 0
输出#1
1.000000000
输入#2
2 2 0 0 1 0
输出#2
0.000000000
说明/提示
Suppose that each bus travel 1 distance unit per second.
In the first sample case, in 0.5 seconds buses will be at distance 1, hence we can choose D = 1.
In the second sample case, in 0.5 seconds both buses will be at (0.5, 0), hence we can choose D = 0.
假设每辆公交车每秒行驶 1 个距离单位。
在第一个样例中,经过 0.5 秒后,公交车将位于距离为 1 的位置,因此我们可以选择 $ D = 1 $。
在第二个样例中,经过 0.5 秒后,两辆公交车都将位于点 $ (0.5,\ 0) $,因此我们可以选择 $ D = 0 $。
输入解题思路,AI测评打分。不知道怎么写?