| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 5 초 | 1024 MB | 23 | 2 | 2 | 13.333% |
Khodislav has taken up orienteering and is participating in a contest. The field is an endless plane without obstacles, and he can move at the same speed in all directions. There are $N$ checkpoints in the field, where every participant must visit in the ascending order of their numbers. The check-in system is contactless --- each checkpoint has a base station that automatically checks in any participant in a range less than or equal to $R$. It is guaranteed that checkpoint coverage areas do not overlap, but they can touch each other.
A participant starts at any point of the first checkpoint coverage and finishes at the moment of checking in at the last checkpoint. Participants are allowed to enter other checkpoint coverage areas on their way to the necessary checkpoint, but in this case, they are not checked in there.
Khodislav is feeling lucky and believes he will be able to cover the distance optimally. Help him calculate the distance he will have to cover.
The first line of the input file contains two integers: $N$ --- the number of checkpoints (2ドル \le N \le 100$) and $R$ --- the check-in radius(1ドル \le R \le 10^9$).
Next come $N$ lines describing the checkpoints in the required check-in order. Each line is a pair of integers $x_i,ドル $y_i$ with the coordinates($-10^9 \le x_i, y_i \le 10^9)$.
Print one real number --- the distance passed if the route is optimal.
The relative or absolute error must not be greater than 0.01. This means that if the optimal answer equals $X,ドル your answer must differ from $X$ by no more than $\frac{1}{100} \max(X, 1)$.
3 3 0 -3 0 100 0 50
141.0
Khodislav starts at $(0, 0),ドル checks in at the second checkpoint at $(0, 97),ドル turns and checks in at the third checkpoint at $(0,53)$. The total distance covered is 97ドル + 44 = 141$.