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

31106번 - Jumping Path 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB111100.000%

문제

Popeye the Sailor loves to eat spinach. He also loves to smoke his corn-made pipe. And which he constantly smokes.

Popeye lives in the Sweethaven village. On the main street of Sweethaven, which can be represented as a straight line, there are $n$ public places, which can be considered as points on a straight line located at coordinates $x_1, x_2, \cdots , x_n,ドル respectively.

Popeye needs to get from the $A$ point on the main street to the $B$ point. Everything would have been simple, if not for the law that passed Sweethaven's authority: now smoking nearer than $r$ from a public place is prohibited. Fortunately, Popeye has a pole length $R \ge r,,ドル with which he can jump over forbidden zones.

Popeye is initially located at point $A$. He can move from $x$ to $y$ on foot in $|x-y|$ time. Also, at any time, he can use the pole and move from point $x$ to point $x+2R$ or $ x-2R,ドル moving along a semicircle of radius $R,ドル while he spends $\pi R$ time. At the end of the path, Popeye must be at point $B,ドル and at no point on the trajectory of Popeye can be closer than $r$ to any public place.

Determine the shortest time it takes Popeye to get from $A$ to $B$. Or determine that it is impossible to get from $A$ to $B$ under the given constraints, so Popeye will have to use the power of spinach.

입력

The first line contains five integers $n,ドル $r,ドル $R,ドル $A$ and $B$ (1ドル \le n \le 500,ドル 1ドル \le r \le R \le 10^6,ドル $-10^9 \le A, B \le 10^9$). The second line contains $n$ integers $x_1, x_2, \cdots , x_n$ ($-10^9 \le x_i \le 10^9,ドル 1ドル \le i \le n$). All $x_i$ are pairwise distinct. It is guaranteed that the points $A$ and $B$ are different and are not located in any of the forbidden zones.

출력

Print one real number --- the smallest time. The answer will be counted if it differs from the jury's answer by no more than 10ドル^{-6}$ in absolute or relative value. If it is impossible to get from $A$ to $B,ドル print $-1$.

제한

예제 입력 1

5 2 5 3 9
13 0 17 7 18

예제 출력 1

55.1238898038

노트

For an example from the statement, one of the optimal trajectories of movement looks as follows:

Elapsed time --- 8ドル + 15\pi$.

출처

Contest > Open Cup > 2020/2021 Season > Stage 16: Grand Prix of Urals J번

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

출처

대학교 대회

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

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