아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Beauty Contest

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

요약
최대 50,000개의 점이 주어질 때 가장 멀리 떨어진 두 농장 사이 거리의 제곱을 구한다.
난이도

보통10점 중 7점

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

문제

Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 ≤ N ≤ 50,000) farms around the world in order to spread goodwill between farmers and their cows. For simplicity, the world will be represented as a two-dimensional plane, where each farm is located at a pair of integer coordinates (x,y), each having a value in the range -10,000 ... 10,000. No two farms share the same pair of coordinates.

Even though Bessie travels directly in a straight line between pairs of farms, the distance between some farms can be quite large, so she wants to bring a suitcase full of hay with her so she has enough food to eat on each leg of her journey. Since Bessie refills her suitcase at every farm she visits, she wants to determine the maximum possible distance she might need to travel so she knows the size of suitcase she must bring. Help Bessie by computing the maximum distance among all pairs of farms.

입력

  • Line 1: A single integer, N
  • Lines 2..N+1: Two space-separated integers x and y specifying coordinate of each farm

출력

  • Line 1: A single integer that is the squared distance between the pair of farms that are farthest apart from each other.

힌트

Farm 1 (0, 0) and farm 3 (1, 1) have the longest distance (square root of 2)

예제1

  1. 예제 1

    입력
    4
    0 0
    0 1
    1 1
    1 0
    
    예상 출력
    2