#P9949. Triangular Pasture
Triangular Pasture
Triangular Pasture
Farmer John wants to build a triangular pasture for his cows. He has N fence posts located at distinct points in the 2D plane, given by coordinates \( (X_1, Y_1), \ldots, (X_N, Y_N) \). He can choose any three points to form a triangle as long as one of its sides is parallel to the \(x\)-axis and another side is parallel to the \(y\)-axis. Such a triangle is a right triangle with its legs parallel to the coordinate axes. Its area is \( \frac{1}{2} \times |\Delta x| \times |\Delta y| \). For convenience, output 2 times the area (which is an integer) of the largest valid triangle.
Input Constraint: \(3 \le N \le 100\). It is guaranteed that at least one valid triangle exists.
inputFormat
The first line contains an integer \(N\) (\(3 \le N \le 100\)). Each of the following \(N\) lines contains two space-separated integers \(X\) and \(Y\), representing the coordinates of a fence post. All points are distinct.
outputFormat
Output a single integer representing twice the maximum area of a triangle pasture that Farmer John can form, where the triangle has one side parallel to the \(x\)-axis and another side parallel to the \(y\)-axis.
sample
4
0 0
0 1
1 0
1 2
2
</p>