Lifeguards

면접 대비

시간 제한1초메모리 제한512 MB

요약
평면 위 n개의 점이 주어질 때, 각 구조대원이 정확히 절반의 수영자와 더 가까워지도록 두 위치를 찾고, 거리가 같은 수영자는 최대 한 명만 허용한다.
난이도

보통10점 중 5점

유형
기하, 정렬, 분할 정복, 구현
정답자
아직 제출이 없습니다

문제

Lifeguards have a very important job. They prevent people from drowning and allow millions of people every year to experience the joys of water. You are one of these lifeguards, and you take your job very seriously. If regulations were up to you, everyone would have to wear life vests when in the water, which is why you are part of the Buoyancy Activists Promoting Change. As a result of your persistent lobbying, the pool at which you are a lifeguard has decided to hire a second lifeguard. You are very happy with the increased security at your local swimming pool.

You get along quite well with the new lifeguard, but you discover you have not prepared his arrival properly; on the first day of working together you have some trouble figuring out who is supposed to watch which swimmers. This is completely unacceptable and could lead to casualties! You immediately start working on this problem: following the mantra “shared responsibility is no responsibility”, you try to divide the people in the swimming pool into two groups as follows: any swimmer is the responsibility of the lifeguard closest to this swimmer. Thus, knowing the exact positions of all swimmers, you and your coworker both find a position such that both of you are responsible for the exact same number of swimmers. Furthermore, you want at most one swimmer for whom the distance to you and your coworker is equal. This swimmer counts for both lifeguards.

As you and your coworker are amazing sprinters, you do not care for the actual distance between you and the swimmers, only that the swimmers are divided nicely into two equally sized groups.

입력

  • The first line contains an integer 2 ≤ n ≤ 105, the number of swimmers.
  • Each of the next n lines contains two integers −109 ≤ x ≤ 109 and −109 ≤ y ≤ 109, the position of the swimmer.

출력

Print two lines, both containing integers x and y with −1018 ≤ x, y ≤ 1018, the locations of you and your coworker.

If there are multiple valid solutions, you may output any one of them.

예제3

  1. 예제 1

    입력
    5
    0 0
    0 1
    1 0
    0 -1
    -1 0
    
    예상 출력
    -3 -1
    3 1
    
  2. 예제 2

    입력
    4
    2 4
    6 -1
    3 5
    -1 -1
    
    예상 출력
    3 4
    3 -1
    
  3. 예제 3

    입력
    4
    5 5
    5 -5
    -5 5
    -5 -5
    
    예상 출력
    1 2
    -1 2