Time limit
2s
Memory limit
128 MB
A point is considered covered by a square when it lies on one of the square's four side segments.
You are given N distinct points. Determine whether there is a square that covers every point, and if so, find its side length. The sides of the square must be parallel to the x-axis or y-axis.
The first line contains N. Each of the next N lines contains two integers, the X-coordinate and Y-coordinate of one point. The absolute value of every coordinate is at most 1000. All coordinates are integers, and no point appears more than once.
If there exists a square that can cover every point, print the side length of that square on the first line. Otherwise, print -1.