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

30564번 - Glacier Travel 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB198842.105%

문제

Glaciers are vast rivers of slowly-flowing ice, fraught with crevasses which hide under thin layers of snow and wait for unsuspecting walkers to step into and fall in. To reduce the danger, hikers usually go in teams tied together with a thick rope to reduce the consequences of a fall--if one person falls in, the other person may yet hold them from a safe distance.

Today, you are roped up to cross a glacier with your partner. Your plan is to follow the exact same route, at the same speed, the first starting earlier and the second beginning to trace steps once you are exactly $x$ metres apart. Were you to follow a completely straight path, you would thus then remain exactly $x$ metres apart at all time.

Figure G.1: An illustration of the path taken in the 2nd sample case, taken from above. This could also be a particularly festive diagram of someone falling into a crevasse.

However, the twisting nature of the course as you avoid obstacles means that you may not always remain exactly $x$ metres apart. What is the closest that you shall actually come while both of you are walking on the path?

입력

  • One line containing a real number: the separation distance along the path in metres, $s$ (1ドル \le s \le 1000$).
  • One line containing the number of points in the path, $n$ (2ドル \le n \le 10^6$).
  • $n$ further lines, the $i$th of which contains a pair of integers giving the $i$th coordinate on the track $x_i y_i$ ($-10^6 \le x, y \le 10^6$) in metres from the origin.

Every pair of adjacent points on the track are distinct from one another, although the track may cross over or repeat itself. The track is guaranteed to have a length of at least $s$.

출력

Output the minimum distance between the two walkers at any point on the route, ignoring any time after the first walker has finished, or before the second walker has started.

The output must be accurate to an absolute or relative error of at most 10ドル^{-4}$.

제한

예제 입력 1

5
4
20 0
10 0
10 10
0 10

예제 출력 1

3.5355339

예제 입력 2

3.16227766
9
-2 4
2 4
3 1
4 4
5 1
6 4
10 2
6 1
7 4

예제 출력 2

1

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2023 G번

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

출처

대학교 대회

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

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