#P5617. [MtOI2019] 不可视境界线

    ID: 6360 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>动态规划 DP数学计算几何2019洛谷原创Special JudgeO2优化洛谷月赛

[MtOI2019] 不可视境界线

Background

「爆ぜろリアル!弾けろシナプス!パニッシュメント......ディス、ワールド!」
「Explode, reality! Shatter, mind! Banish this world!」

Problem Description

Rikka firmly believes that her father is waiting for her inside the “Invisible Boundary Line”. In Rikka’s dream, the “Invisible Boundary Line” appeared as a figure made up of nn circles.

Specifically, there is a Cartesian coordinate system. On the xx-axis, there are nn points, and the ii-th point is (xi,0)(x_i,0).

Using each point as a center, Rikka drew nn circles with radius rr. She originally wanted you to help her compute the union area of these nn circles, but that problem is too easy.

After some thought, Rikka wants you to compute the maximum possible union area of the circles after selecting kk circles (i.e., deleting nkn-k circles).

For all testdata, n,k105n,k\leq 10^5, r104r\leq 10^4, 0xi1090\leq x_i\leq 10^9, xix_i are integers and pairwise distinct. It is guaranteed that the input xix_i are strictly increasing.

Because the answer is very large, and Rikka thinks your computer cannot maintain high precision, your answer will be considered correct as long as its relative error is less than 5×1085\times 10^{-8} compared to the standard answer.

After error analysis, this problem guarantees that using the native cmath functions will not cause issues. Please pay attention to controlling precision errors in your program.

Input Format

There are 22 lines in total.

Line 11 contains 33 integers nn, kk, and rr.

Line 22 contains nn integers x1xnx_1\ldots x_n.

Output Format

Output one real number in one line, representing the required answer. It is guaranteed that the answer is less than 101410^{14}.

8 5 2
1 3 7 11 15 21 27 33
62.83185307
8 5 8
1 3 7 11 15 21 27 33
686.19551835

Hint

Sample Explanation 1

Obviously, you can choose 55 non-overlapping circles with radius 22.

Subtasks

For 100%100\% of the testdata, n,k105n,k\leq 10^5, r104r\leq 10^4, 0xi1090\leq x_i\leq 10^9.

This problem uses bundled tests. There are 77 subtasks, and the score and constraints of each subtask are as follows:

Subtask 11 (1111 points): k=nk=n.

Subtask 22 (1313 points): n,k,r100n,k,r \leq 100.

Subtask 33 (66 points): n,k1000n,k \leq 1000, r20r\leq 20.

Subtask 44 (1515 points): n,k,r2000n,k,r \leq 2000, and the testdata are guaranteed to be randomly generated.

Subtask 55 (2323 points): r20r\leq 20.

Subtask 66 (1212 points): k20k\leq 20, xnkrx_n \leq kr.

Subtask 77 (2020 points): no special constraints.

Source

MtOI2019 Extra Round T5

Problem setter: disangan233

Problem reviewer: suwAKow, _sys

Translated by ChatGPT 5