시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 743 150 84 17.684%

문제

좌표 평면에 N (4<=N<=1,500) 개의 점이 주어진다.

서로 다른 점 4개를 선택하면 사각형을 만들 수 있다. 이러한 사각형 중에 직사각형인 것 중 넓이가 가장 큰 것을 구하는 프로그램을 작성하시오.

입력

첫째 줄에 점의 개수 N이 주어진다. 둘째 줄부터 N개의 줄에 점의 좌표 x y가 주어진다. 점의 좌표는 -10^8보다 크거나 같고, 10^8보다 작거나 같은 정수이다. 점의 좌표는 중복되지 않는다.

출력

가장 큰 직사각형의 넓이를 출력한다.

예제 입력 1

8
-2 3
-2 -1
0 3
0 -1
1 -1
2 1
-3 1
-2 1

예제 출력 1

10

힌트

W3sicHJvYmxlbV9pZCI6IjI0MTUiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM5YzFcdWMwYWNcdWFjMDFcdWQ2MTUiLCJkZXNjcmlwdGlvbiI6IjxwPlx1Yzg4Y1x1ZDQ1YyBcdWQzYzlcdWJhNzRcdWM1ZDAgTiAoNCZsdDs9TiZsdDs9MSw1MDApIFx1YWMxY1x1Yzc1OCBcdWM4MTBcdWM3NzQgXHVjOGZjXHVjNWI0XHVjOWM0XHViMmU0LjxcL3A+PHA+XHVjMTFjXHViODVjIFx1YjJlNFx1Yjk3OCBcdWM4MTAgNFx1YWMxY1x1Yjk3YyBcdWMxMjBcdWQwZGRcdWQ1NThcdWJhNzQgXHVjMGFjXHVhYzAxXHVkNjE1XHVjNzQ0IFx1YjljY1x1YjRlNCBcdWMyMTggXHVjNzg4XHViMmU0LiBcdWM3NzRcdWI3ZWNcdWQ1NWMgXHVjMGFjXHVhYzAxXHVkNjE1IFx1YzkxMVx1YzVkMCBcdWM5YzFcdWMwYWNcdWFjMDFcdWQ2MTVcdWM3NzggXHVhYzgzIFx1YzkxMSBcdWIxMTNcdWM3NzRcdWFjMDAgXHVhYzAwXHVjN2E1IFx1ZDA3MCBcdWFjODNcdW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