시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB255281046840.802%

문제

평면상에 n개의 점 (P1, .... ,  Pn) 이 놓여져있다고 했을 때, 거리가 최소인 두 개의 점을 구하고 그 거리를 알고 싶다.

입력

입력은 첫 번째 줄에 정수로 된 점의 개수 n이 주어진다.

두 번째 줄부터 n+1번째 줄까지 2개의 정수 x,y가 공백을 사이에 두고 주어진다. 

i+1번째 줄은 Pi 의 x,y 좌표를 의미하고 n개의 점에 대해서 주어지게 된다.

점의 개수는 2 ≦ n ≦ 500000 , 좌표의 범위는 -10000 ≦ x,y ≦10000로 주어진다.

또한, 모든 점의 좌표는 같은 것이 없이 다른 것으로 한다.

출력

가장 가까운 두 점 사이의 거리의 제곱을 출력하시오.

예제 입력 1

3
5 5
0 0
-3 -4

예제 출력 1

25

예제 입력 2

2
0 0
1 1

예제 출력 2

2
W3sicHJvYmxlbV9pZCI6IjU2MjAiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjMDBcdWM3YTUgXHVhYzAwXHVhZTRjXHVjNmI0IFx1YjQ1MCBcdWM4MTBcdWM3NTggXHVhYzcwXHViOWFjIiwiZGVzY3JpcHRpb24iOiI8cD5cdWQzYzlcdWJhNzRcdWMwYzFcdWM1ZDAgblx1YWMxY1x1Yzc1OCBcdWM4MTAgKFAxLCAuLi4uICwgJm5ic3A7UG4pIFx1Yzc3NCBcdWIxOTNcdWM1ZWNcdWM4MzhcdWM3ODhcdWIyZTRcdWFjZTAgXHVkNTg4XHVjNzQ0IFx1YjU0YywgXHVhYzcwXHViOWFjXHVhYzAwIFx1Y2Q1Y1x1YzE4Y1x1Yzc3OCBcdWI0NTAgXHVhYzFjXHVjNzU4IFx1YzgxMFx1Yzc0NCBcdWFkNmNcdWQ1NThcdWFjZTAgXHVhZGY4IFx1YWM3MFx1YjlhY1x1Yjk3YyBcdWM1NGNcdWFjZTAgXHVjMmY2XHViMmU0LjxcL3A+XHJcbiIsImlucHV0IjoiPHA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