RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
ICPC00064

H. Polygonal Puzzle

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
Unrated 레이팅 미적용
난이도
20s
시간 제한
1024MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

During last year’s ACM ICPC World Finals in Marrakesh, one of the judges bought a pretty wooden puzzle depicting a camel and palm trees (see Figure H.1). Unlike traditional jigsaw puzzles, which are usually created by cutting up an existing rectangular picture, all the pieces of this puzzle have been cut and painted separately. As a result, adjacent pieces often do not share common picture elements or colors. Moreover, the resulting picture itself is irregularly shaped. Given these properties, the shape of individual pieces is often the only possible way to tell where each piece should be placed. Figure H.1: The judge’s wooden puzzle. The judge has been wondering ever since last year whether it is possible to write a program to solve this puzzle. An important part of such a program is a method to evaluate how well two puzzle pieces “match” each other. The better the match, the more likely it is that those pieces are adjacent in the puzzle. Pieces are modeled as simple polygons. Your task is to find a placement of two given polygons such that their interiors do not overlap but the polygons touch with their boundaries and the length of the common boundary is maximized. For this placement, polygons can be translated and rotated, but not reflected or resized. Figure H.2 illustrates the optimal placement for Sample Input 1.

제약
입력 형식

The input contains the description of two polygons, one after the other. Each polygon description starts with a line containing an integer \(n\) (\(3 \le n \le 50\)) denoting the number of vertices of the polygon. This is followed by \(n\) lines, each containing two integer coordinates \(x\), \(y\) of a polygon vertex (|\(x\)|, |\(y\)| ≤100). The vertices of each polygon are given in clockwise order, and no three consecutive vertices are collinear. The input data is chosen so that even if the vertices were moved by a distance of up to \(10^{−}^{7}\), the answer would not increase by more than \(10^{−}^{4}\). Figure H.2: Sample Input 1 and its optimal placement.

출력 형식

Display the maximum possible length of the common boundary of these polygons when they are op\(ti- ma\)lly placed. Your answer should have an absolute or relative error of less than \(10^{−}^{3}\).

예제 1
입력
8
0 0
0 10
10 10
15 15
24 6
24 10
30 10
30 0
7
-5 0
-5 10
10 10
15 5
20 10
35 10
35 0
출력
30.142135624
예제 2
입력
3
1 0
0 30
40 0
3
1 0
0 30
40 0
출력
50
문제 정보

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

출처 ICPC World Finals 2016

평가 및 의견

H. Polygonal Puzzle

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

Log in to rate problems.

개별 의견

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

풀이 제출

H. Polygonal Puzzle

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