Wedding Hall
Time limit1sMemory limit128 MB
Find the largest L-shaped hall of three equal squares that fits inside a walled garden without enclosing any tree.
- Level
Hard8 of 10
- Topics
- Geometry, Binary search, Segment tree, Sorting
- Solved
- No attempts yet
Problem
Kamran has just bought a flat rectangular garden in a nice part of the countryside. The countryside has become a popular place for weddings, so he wants to build a hall for wedding ceremonies in the garden.
The law requires the men's section and the women's section to be separated, so Kamran plans a hall in three parts: a men's section, a women's section and a common section that holds the rest rooms, the dinner room and so on. Everyone has to reach the common section easily, so it goes between the other two. Of the several proposed designs Kamran picked the one in the figure below. The three sections are squares of the same size, they are attached to each other in an L shape, and their sides are parallel to the sides of the garden. The two sides of the common section that show from outside face the south and the west of the garden.
A hall of side whose lower left corner is at covers the union of three squares.
The first square is the common section and the other two are the men's and the women's sections.
The remaining question is where to build the hall. The garden is full of old trees, and cutting a tree is forbidden because the air pollution is high. Kamran asks you to find the largest hall he can build.

Input
The input has several test cases. The first line of a test case holds an integer and two positive integers and (, ). is the number of trees in the garden, and the garden is the rectangle . Each of the next lines holds the coordinates and of one tree, separated by a space (, ). All coordinates are integers and no two trees share a position. The south side of the garden lies on the axis and the west side lies on the axis.
A line 0 0 0 ends the input and is not processed.
Output
For each test case, print the area of the largest hall Kamran can build on one line. The hall may touch a tree or a side of the garden but may not contain it in its interior, so a tree may sit on the boundary of the hall and the hall has to stay inside the garden.
Print the area with two digits after the decimal point. The side of the largest hall is always a multiple of , so the area is a multiple of and two digits print it exactly.