Width of a Point Set
Time limit2sMemory limit512 MB
Given up to 100000 points, compute the integer part of the squared minimum width of a strip enclosing all points.
- Level
Medium7 of 10
- Topics
- Geometry, Two pointers
- Solved
- No attempts yet
Problem
Consider a set of points in the plane. The width of is the minimum distance between two parallel lines that enclose . Figure 1 shows an example.

Figure 1: The width of a set of three points.
There consists of the points , and . The width is realized by the two lines and , whose distance is . In this task you are given a set of points and you have to compute the integer part of and print it. For Figure 1, , so , and you print the integer part of , which is .
Here is a formula that helps. Let , and be three points. The height of the triangle (see Figure 2) is
where if is counterclockwise (as in Figure 2) and if is clockwise.

Figure 2: Triangle .
If all points of lie on one straight line, the width is zero.
Input
The first line contains the integer , the number of points in . Each of the next lines contains the coordinate and the coordinate of one point, separated by a single space.
The coordinates are integers between 0 and 199 inclusive. There are at most 100000 points, and the same point may appear several times.
Output
Print the integer part of .