시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 149 | 40 | 20 | 22.989% |
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.
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.)
0 0 6 0 2 1 1 2 5 1 2
6.32455532034
0 0 7 0 2 1 1 2 6 1 2
impossible
0 0 1 3 3 0 -1 2 4 -1 3 2 3 2
4.269334912857045697
Figure 2: Illustration of the third example input.