Logo
(追記) (追記ここまで)

31124번 - Orienteering 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 1024 MB232213.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)$.

제한

예제 입력 1

3 3
0 -3
0 100
0 50

예제 출력 1

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$.

출처

Contest > Open Cup > 2021/2022 Season > Stage 5: Grand Prix of Siberia 2번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /