#P6455. 不可视境界线[环版本]

    ID: 7211 远端评测题 1000~4000ms 250MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>动态规划 DP计算几何二分单调队列Special Judge分治随机调整凸完全单调性(wqs 二分)

不可视境界线[环版本]

Background

Appendix: Some information about this problem’s SPJ and testdata.

If there are issues such as precision hacks, broken testdata, or cases that beat the intended solution, please contact the problem setter.

Problem Description

There are nn circles with radius rr, drawn on a paper ring of length LL whose ends are connected.

All circle centers are at the same height. You can think of drawing a number line on the paper and then rolling it up; the positions of the centers are described by points on this number line.

If you cannot understand how the circles are distributed on the ring, please refer to the sample explanation and subtasks.

You need to choose kk circles so that the area of the union of all chosen circles is maximized.

Note that you must output an exact selection scheme, not just the maximum union area.

Input Format

The first line contains four integers n,k,r,Ln, k, r, L, with meanings as described in the statement.

The second line contains nn integers. The ii-th integer p[i]p[i] describes the position of the ii-th circle center on the paper ring (the coordinate on the number line).

For 2<i<n2<i<n, we have p[i1]<p[i]p[i-1] < p[i].

Output Format

Output one line containing kk integers, representing the indices of the circles you selected. The SPJ will compute the union area.

You must ensure these indices are strictly increasing and within [1,n][1,n]. Otherwise, it is considered invalid and you will receive no score.

It is considered correct if the relative error compared to the standard answer does not exceed 10910^{-9}, and the absolute error does not exceed 0.10.1.

By estimation, the answer will not exceed the order of magnitude 101210^{12}.

5 3 10 30
0 7 14 21 28 
2 3 5 
10 3 10 65
0 7 15 24 30 36 41 49 57 63 
3 6 9
30 10 50 169
0 7 14 21 28 35 42 45 51 55 61 65 68 75 79 83 87 94 97 105 113 118 126 133 140 147 151 156 163 167 
3 5 8 11 15 19 21 24 27 30 

Hint

Sample Explanation:

  • Sample 1: The final union area is approximately 565.871835565.871835.

The distribution of circles is shown in the figure. Here, A⊙A and A2⊙A2 are the same circle, and B⊙B and B2⊙B2 are the same circle.

This can be viewed as shifting to the right by L=30L = 30 units. In fact, this is equivalent to making a full round on the paper ring and returning to the start.

Since they are the same circle, the area covered by the red part cannot be counted repeatedly. The maximum union area is the blue part.

  • Sample 2: The final union area is approximately 942.477796942.477796.

  • Sample 3: The final union area is approximately 16817.05854716817.058547.

Constraints and Conventions:

Subtask ID n k Time Limit
1 1010 - 1s\texttt{1s}
2 100100
3 20002000 1.6s\texttt{1.6s}
4 3×1043\times 10^4 100100 2.2s\texttt{2.2s}
5 1×1051\times 10^5 - 3s\texttt{3s}

The time limit is more than twice the running time of std.

For all testdata, n105n \leq 10^5, 10r200010 \leq r \leq 2000, 0p[i]<L1080 \leq p[i] < L \leq 10^8, 4r<L4r < L, 3kn3 \leq k \leq n.

All values in the table are upper bounds. Note that some lower-bound restrictions may help remove certain boundary cases.

Translated by ChatGPT 5