Fence In Godzilla!
Time limit1sMemory limit128 MB
The task is to find the smallest nonzero area among triangles with vertices from n points.
- Level
Hard8 of 10
- Topics
- Geometry, Sorting, Two pointers
- Solved
- No attempts yet
Problem
We caught Godzilla! After a long chase we finally managed to trap Godzilla, who had been brazenly chewing through the television cables. The only question left is where to keep the beast.
Someone suggested fencing Godzilla in with a triangular enclosure. Each of the three corners of the fence must stand at a tree growing in the forest. In other words, you pick three of the given trees and use their positions as the vertices of a triangular plot.
To leave as much of the forest as possible, the area of the triangular plot holding Godzilla must be as small as possible. Determine how small this triangular plot can be.
Input
The first line contains the number of trees ().
Each of the next lines contains two integers and , the coordinates of one tree, separated by a space ().
No two trees stand at the same point, and not all of the trees lie on a single line.
Output
Among all triangles whose vertices are three of the trees, find the one with the smallest area and print a single integer equal to twice that area.
Degenerate triangles, whose three vertices are collinear and whose area is , are not considered: you cannot keep Godzilla inside one of those.
Because all coordinates are integers, twice the area is always an integer.