포럼
문제 ICPC00244

K. Keeping the Dogs Apart

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

Despite the unfortunate incident last summer, which resulted in ten little puppies, you have been tasked with taking care of your neighbors’ dogs again. Shadow and Lydia may be very cute mutts, but this year you have strict instructions to walk them one by one. However, you have other things to do during the summer than walking dogs! Like playing fetch and solving programming problems! It seems terribly inefficient to walk the dogs one at a time.

Shadow and Lydia have a particular walk they each prefer and know by heart. If you just let them out, they will follow their favorite walk, eventually ending up in their respective doghouses. Problem solved!

Sadly, you realize that if you just let both dogs out at the same time and let them do their walks on their own, they might get too close to each other. If they get too close, they will leave their favorite walk to "have some fun’’ and you are not sure you can find good homes for any more puppies. To ensure this does not happen, you need to calculate the minimum distance between the dogs when they are out walking on their own.

Both dogs start at the same time and keep exactly the same pace. Immediately after a dog arrives at its doghouse it stays inside and goes to sleep, so we no longer need to worry about the distance to the other dog, even though the other dog may still walk for a while longer. Note that a dog is still awake at the exact moment of entering its house and falls asleep immediately after entering.

제약
입력 형식

The first line of input consists of an integer \(n\) (\(2 \le n \le 100\,000\)), the number of points describing the walk of Shadow. The next \(n\) lines contain \(2\) integers each, giving the \(x\) and \(y\) coordinates of Shadow's walk. Two consecutive points in the walk always differ in at least one coordinate. All coordinates are non-negative and at most \(10\,000\). Similarly, the next line contains an integer \(m\) (\(2 \le m \le 100\,000\)), the number of points describing the walk of Lydia. The next \(m\) lines describe its walk in the same format as for Shadow.

출력 형식

Output the minimum distance between the two dogs during their walks. The numbers should be accurate to an absolute or relative error of at most \(10^{-4}\).

예제 1
입력
2
0 0
10 0
2
30 0
15 0
출력
10
예제 2
입력
5
10 0
10 8
2 8
2 0
10 0
9
0 8
4 8
4 12
0 12
0 8
4 8
4 12
0 12
0 8
출력
1.414213562373
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NCPC 2016

평가 및 의견

K. Keeping the Dogs Apart

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

K. Keeping the Dogs Apart

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8