CF908C.New Year and Curling
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Carol is currently curling.
She has n disks each with radius r on the 2D plane.
Initially she has all these disks above the line y = 10100.
She then will slide the disks towards the line y = 0 one by one in order from 1 to n.
When she slides the i-th disk, she will place its center at the point (x__i, 10100). She will then push it so the disk’s y coordinate continuously decreases, and x coordinate stays constant. The disk stops once it touches the line y = 0 or it touches any previous disk. Note that once a disk stops moving, it will not move again, even if hit by another disk.
Compute the y-coordinates of centers of all the disks after all disks have been pushed.
卡罗尔正在玩冰壶游戏。
她在二维平面上有 $ n $ 个半径均为 $ r $ 的圆盘。
初始时,所有这些圆盘均位于直线 $ y = 10^{100} $ 的上方。
接着,她将按编号从 1 到 $ n $ 的顺序,逐个将圆盘向直线 $ y = 0 $ 滑动。
当滑动第 $ i $ 个圆盘时,她先将其圆心置于点 $ (x_i,, 10^{100}) $,然后沿竖直方向向下推动该圆盘(即其 $ x $ 坐标保持恒定,而 $ y $ 坐标持续减小)。该圆盘在碰到直线 $ y = 0 $ 或碰到任意一个先前已停止的圆盘时立即停止。注意:一旦某个圆盘停止运动,它便不再移动,即使之后被其他圆盘碰撞亦然。
请计算所有圆盘全部被推动完毕后,各圆盘圆心的 $ y $ 坐标值。
输入格式
The first line will contain two integers n and r (1 ≤ n, r ≤ 1 000), the number of disks, and the radius of the disks, respectively.
The next line will contain n integers _x_1, _x_2, ..., x__n (1 ≤ x__i ≤ 1 000) — the x-coordinates of the disks.
第一行包含两个整数 n 和 r(1 ≤ n, r ≤ 1 000),分别表示圆盘的数量和圆盘的半径。
第二行包含 n 个整数 x1, x2, ..., xn(1 ≤ xi ≤ 1 000)——表示各圆盘的 x 坐标。
输出格式
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6.
Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker program will consider your answer correct if
for all coordinates.
输出一行,包含 n 个数字。其中第 i 个数字表示第 i 个圆盘中心的 y 坐标。若输出的绝对误差或相对误差均不超过 10 - 6,则视为正确。
具体而言,假设你对某个坐标值给出的答案为 a,而裁判的标准答案为 b。对于所有坐标,只要满足
,评测程序即判定你的答案正确。
输入输出样例
输入#1
6 2 5 5 6 8 3 12
输出#1
2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613
说明/提示
The final positions of the disks will look as follows:

In particular, note the position of the last disk.
磁盘的最终位置如下所示:

特别注意最后一个磁盘的位置。
输入解题思路,AI测评打分。不知道怎么写?