Triangle on the Axis
InterviewTime limit2sMemory limit2048 MB
Given integer points in the plane, find the largest-area triangle with one side on the Ox axis, or print 0 if no non-degenerate triangle exists.
- Level
Easy2 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Statement
You are given a set of points on a plane with integer coordinates. Find the triangle with the largest area whose vertices all belong to this set and whose one side lies on the axis.
Input
The first line contains an integer , the number of points (). Each of the following lines contains two integers and , the coordinates of a point. All coordinates are at most in absolute value.
Output
Output a single real number, the maximum area of a triangle that satisfies the conditions. If no such triangle exists, or the only triangles are degenerate, output . Your answer is correct if it differs from the exact value by no more than .
Hint
The picture is shown below. 