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

10518번 - Around the Track 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB102271534.884%

문제

In order to compare race tracks, we wish to compute their lengths. A racetrack is strictly two-dimensional (no elevation). It is described by two simple polygons, where one is completely contained inside the other. The track is the region between these two polygons. We define the length of the track as the absolute minimum distance that one needs to travel in order to complete a lap. This could involve traveling on the very edge of the track and arbitrarily sharp cornering (see Figure A.1).

Figure A.1: Illustration of sample input number 3 together with the shortest route around the track (dashed).

입력

The input consists of:

  • one line with one integer n (3 ≤ n ≤ 50), the number of vertices of the inner polygon;
  • n lines, the ith of which contains two integers xi and yi (−5 000 ≤ xi, yi ≤ 5 000): the coordinates of the ith vertex of the inner polygon;
  • one line with one integer m (3 ≤ m ≤ 50), the number of vertices of the outer polygon;
  • m lines, the ith of which contains two integers xi and yi (−5 000 ≤ xi, yi ≤ 5 000): the coordinates of the ith vertex of the outer polygon.

For both polygons, the vertices are given in counterclockwise order. The borders of the two polygons do not intersect or touch each other.

출력

Output one line with one floating point number: the length of the race track. Your answer should have an absolute or relative error of at most 10−6.

제한

예제 입력 1

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

예제 출력 1

3.41421356237309

예제 입력 2

5
1 1
5 1
5 5
3 3
1 5
4
0 0
6 0
6 6
0 6

예제 출력 2

16

예제 입력 3

5
1 1
5 1
5 5
3 3
1 5
5
0 0
6 0
6 6
3 4
0 6

예제 출력 3

16.4721359549996

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2014 A번

  • 문제를 만든 사람: Thomas Beuman
(追記) (追記ここまで)

출처

대학교 대회

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

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