#P6455. 不可视境界线[环版本]
不可视境界线[环版本]
Background
- Original problem: P5617 [MtOI2019]Invisible Boundary Line.
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 circles with radius , drawn on a paper ring of length 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 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 , with meanings as described in the statement.
The second line contains integers. The -th integer describes the position of the -th circle center on the paper ring (the coordinate on the number line).
For , we have .
Output Format
Output one line containing 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 . 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 , and the absolute error does not exceed .
By estimation, the answer will not exceed the order of magnitude .
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 .
The distribution of circles is shown in the figure. Here, and are the same circle, and and are the same circle.
This can be viewed as shifting to the right by 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 .
-
Sample 3: The final union area is approximately .
Constraints and Conventions:
| Subtask ID | n | k | Time Limit |
|---|---|---|---|
| 1 | - | ||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | - |
The time limit is more than twice the running time of std.
For all testdata, , , , , .
All values in the table are upper bounds. Note that some lower-bound restrictions may help remove certain boundary cases.
Translated by ChatGPT 5