Pea-City

면접 대비

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

요약
N개의 점이 주어질 때 모든 점을 포함하는 최소 넓이 직사각형을 찾아 네 꼭짓점을 반시계 방향으로 출력한다.
난이도

어려움10점 중 8점

유형
기하, 수학, 완전 탐색, 이분 탐색
정답자
아직 제출이 없습니다

문제

The Pea King was a wise ruler and a good strategist. He spent all his time dealing with the state affairs. As the kingdom grew, population increased. The new houses popped up everywhere like mushrooms after the rain. The kings of neighboring states were becoming envious and started to plan a war. In order to protect the capital from the invaders, the Pea King decided to build a new city wall around the capital borders that would lock all the buildings on the city outskirts inside of it as well.

For the aesthetic effect, namely to make the map on the wall in king’s parlor look pretty, it was decided that the capital city should have rectangular borders. Keeping this in mind the total land area should remain as minimal as possible and all the NN houses registered should stay inside the borders of the rectangular city.

입력

The first line contains single integer NN --- number of houses in the city (3≤N≤80,0003 \le N \le 80\\,000). The following NN lines contain pairs of integers XX, YY — Cartesian coordinates of the houses (−25,000≤X,Y≤25,000-25\\,000 \le X, Y \le 25\\,000). It’s guaranteed that there are at least three houses not on one line.

출력

Output the coordinates of the rectangular corner points in the counterclockwise order, each pair of coordinates on a separate line. The answer is considered correct if the absolute or relative error for rectangular area does not exceed 10−510^{-5} and all houses are strictly inside the city or at the distance not exceeding 10−510^{-5} from its borders.

예제1

  1. 예제 1

    입력
    3
    0 0
    2 2
    2 0
    
    예상 출력
    0.000000 2.000000
    0.000000 0.000000
    2.000000 0.000000
    2.000000 2.000000