#P9949. [USACO20FEB] Triangles B
[USACO20FEB] Triangles B
Problem Description
Farmer John wants to build a triangular pasture for his cows.
There are () fence posts located at distinct points on the 2D plane of the farm. He can choose three of these points to form a triangular pasture, as long as one side of the triangle is parallel to the -axis and another side is parallel to the -axis.
What is the maximum area of a pasture Farmer John can enclose? It is guaranteed that there is at least one valid triangular pasture.
Input Format
The first line contains an integer . The next lines each contain two integers and , both in the range , describing the position of a fence post.
Output Format
Since the area may not be an integer, output twice the maximum area of a valid triangle that can be formed by the fence posts.
4
0 0
0 1
1 0
1 2
2
Hint
Sample Explanation 1
The posts at , , and form a triangle with area . Therefore, the answer is . There is only one other triangle, with area .
Translated by ChatGPT 5