Symmetric Boundary

시간 제한12초메모리 제한1024 MB

요약
볼록 다각형이 주어질 때, 모든 꼭짓점을 경계에 포함하는 볼록한 점대칭 영역의 최소 넓이를 구하거나, 존재하지 않으면 -1을 출력한다.
난이도

어려움10점 중 8점

유형
기하, 그리디, 이분 탐색, 구현
정답자
아직 제출이 없습니다

문제

Symmetrical figures are beautiful—and they are the subject of this task. A region in a 2D plane is convex if, for every pair of points pp and qq in the region, the segment connecting pp and qq is entirely included in the region. Also, a region in a 2D plane is point-symmetric if, when you rotate the region by 180180 degrees around a certain point, the rotated region exactly matches the original region.

You are given a convex polygon in a 2D plane with nn vertices, numbered from 11 to nn in counterclockwise order. Vertex ii has coordinates (x_i,y_i)(x\_i , y\_i). No three vertices are collinear. Determine whether there exists a convex, pointsymmetric region containing all of the nn vertices on its boundary. If one or more such regions exist, compute the minimum area among all of them.

입력

The first line of input contains one integer nn (3≤n≤303 ≤ n ≤ 30). Each of the next nn lines contains two integers. The ii-th line contains x_ix\_i and y_iy\_i (0≤x_i,y_i≤10000 ≤ x\_i , y\_i ≤ 1000).

It is guaranteed that the given polygon is convex, its vertices are given in counterclockwise order, and no three of its vertices are collinear.

출력

If one or more such regions exist, output the minimum area among all of them. The relative error of the output must be within 10−910^{-9}.

If such a region does not exist, output -1 instead.

힌트

Figure I.1 illustrates the vertices in the sample input as black dots. For sample inputs #1 and #3, the shaded regions represent the regions with the minimum possible area.

Figure I.1: Illustrations of the sample inputs (from left to right).

예제3

  1. 예제 1

    입력
    4
    0 0
    10 0
    8 9
    4 9
    
    예상 출력
    90.0
    
  2. 예제 2

    입력
    8
    8 10
    2 9
    0 8
    0 2
    2 0
    8 0
    10 2
    10 8
    
    예상 출력
    -1
    
  3. 예제 3

    입력
    6
    231 77
    359 20
    829 124
    998 461
    941 735
    879 825
    
    예상 출력
    486567.9669655848