There are points in a 2D plane. You can place any square on the plane as long as the square is rectilinearly oriented, i.e., its sides are paralleled to the
and
axis. What is the minimum area of a square that can cover at least two points in the plane?
Input Specification
- The first line contains one integer
representing the number of points in the plane.
- The next
lines are the
and
coordinates of the points. The
and
coordinate values are separated by a space. It is guaranteed that
and
are integers and in the range of
.
- You can assume that the points are unique.
Output Specification
An integer represents the minimum area of a square that can cover at least two points in the plane.
Sample Input 1
3
0 0
2 1
-2 -4
Sample Output 1
4
Explanation for Sample Output 1
A possible square is with the lower left corner and upper right corner locating at and
, which can cover points
and
. The area of this square is
.
Sample Input 2
3
0 0
2 2
3 3
Sample Output 2
1
Explanation for Sample Output 2
A possible square is with the lower left corner and upper right corner locating at and
, which can cover points
and
. The area of this square is
.
Comments