Largest Triangle
Time limit1sMemory limit2048 MB
Given an x-monotone terrain polyline from y=0 to y=0, find the largest-area triangle inside the terrain that has one vertex at one of the interior points p2 to p(n-1).
- Level
Hard8 of 10
- Topics
- Geometry, Divide and conquer, Two pointers
- Solved
- No attempts yet
Problem
A terrain is an -monotone polygon defined by the points , where each point has coordinates , and the following three conditions hold:
- for
- for
Given a terrain defined by the points , find the largest triangle that lies entirely within the terrain and has one of its three vertices at one of the terrain points through .

Input
The first line contains an integer , the number of points in the terrain (). Each of the next lines contains two space-separated integers and , the coordinates of point ().
Output
Print the area of the largest triangle that lies entirely within the terrain. A answer is accepted if its absolute or relative error is at most .