King Brian is looking at rectangles!
He has a list of points and can select any four at random. If the four points form the four corners of an axis aligned rectangle, he writes down the area.
What is the largest possible area he can get from selecting four random points?
Note: axis aligned means that the four lines that form the rectangle are all either horizontal or vertical (aligning with the and axes respectively).
Constraints
For all subtasks:
No two points will be the same.
Subtask 1 [15%]
Subtask 2 [70%]
Subtask 3 [15%]
No additional constraints.
Input Specification
The first line will contain the integer .
The next lines will each contain two space separated integers: , .
Output Specification
Output one line, the maximum possible area of an axis aligned rectangle King Brian can get from selecting four random points. If no rectangles can be formed, print .
Sample Input
9
1 1
5 5
7 7
5 7
7 5
10 10
5 10
10 5
20 20
Sample Output
25
Sample Explanation
There are two possible rectangles that can be constructed with the points:
- From to with an area of
- From to with an area of
Thus the answer is .
Comments
Negative coordinates are possible. I'm dumb and missed that in the constraints.
from (1,1) to (20,20) with an area of 361 what?
guys, nvm, I get it, we have to have all 4 points in the points list, python3 is a bit hard
your code works in pypy3 (erm oops didn't know u solved it)