Problem D
Aspen Avenue
![/problems/aspenavenue/file/statement/en/img-0001.jpg](/problems/aspenavenue/file/statement/en/img-0001.jpg)
Input
The input file starts with a positive even integer $N$ between $4$ and $2\, 000$ (inclusive), giving the total number of trees in the avenue. The next line contains two integers $L$ and $W$, where $1 \le L \le 10\, 000$ is the length of the road, in meters, and $1 \le W \le 20$ is the width of the road, in meters. The next $N$ lines each describe where Tim had dropped of the trees. Each such line contains an integer $0 \le p \le L$ indicating the position of a tree plant along the left side of the road, measured in meters from the start of the road.
Output
Output the smallest total number of meters the tree plants need to be moved. The answer should be given with an absolute or relative error of at most $10^{-6}$.
Sample Input 1 | Sample Output 1 |
---|---|
4 10 1 1 0 10 10 |
2.4142135624 |
Sample Input 2 | Sample Output 2 |
---|---|
6 10 1 0 9 3 5 5 6 |
9.2853832858 |