## Appleby Contest '19 P4 - Rectangles

View as PDF

Points: 7 (partial)
Time limit: 1.0s
C 0.6s
C++ 0.6s
Memory limit: 64M
Python 256M

Author:
Problem types

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

No two points will be the same.

#### 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