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

15004번 - Bearly Made It 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB181553026.549%

문제

Barney the polar has wandered off on an adventure. Lost in thought, he suddenly realizes he has strayed too far from his mother and is stuck on an ice shelf. He can still see her in the distance, but the only way back is by crossing a group of other ice shelves, all of which are perfectly circular. He is very scared, and can not swim. Barney’s mother, getting a little tired of her son’s shenanigans, decides to wait and let him figure this out for himself. Can you help Barney get home? He is in a hurry.

입력

  • The first line of input contains four integers, −106 ≤ xb, yb, xm, ym ≤ 106, where (xb, yb) is Barney’s location and (xm, ym) is the location where Barney’s mom is waiting.
  • The next line contains a single integer 1 ≤ n ≤ 25, the number of ice shelves.
  • After this n lines follow. Each line holds three integers: −106 ≤ xi , yi ≤ 106 and 1 ≤ ri ≤ 106, the coordinates of the center of the shelf and its radius. A shelf consists of all points at distance ri or less to (xi, yi).

Both bears are on a shelf at the start of Barney’s journey home. Shelves can both touch and overlap.

출력

The minimal distance Barney has to travel to be reunited with his mother. The result should have a relative error of at most 10−6.

If there is no way for Barney to make it home, output “impossible”. (Do not worry about Barney’s well-being in this scenario. His mother will swim out to save him.)

제한

예제 입력 1

0 0 6 0
2
1 1 2
5 1 2

예제 출력 1

6.32455532034

예제 입력 2

0 0 7 0
2
1 1 2
6 1 2

예제 출력 2

impossible

예제 입력 3

0 0 1 3
3
0 -1 2
4 -1 3
2 3 2

예제 출력 3

4.269334912857045697

힌트

Figure 2: Illustration of the third example input.

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2017 B번

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

출처

대학교 대회

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

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