#P10251. Minimum Covering Rectangle Area

    ID: 12249 Type: Default 1000ms 256MiB

Minimum Covering Rectangle Area

Minimum Covering Rectangle Area

ZHY wants to manage his farms. He owns n rectangular farms, each with sides parallel to the coordinate axes. Note that these farms can overlap. He wants to fence off a piece of land that completely covers all the farms using a rectangle (with edges parallel to the axes) and he wants the area of this rectangle to be as small as possible.

For each farm given by its bottom-left corner (x1, y1) and top-right corner (x2, y2), the smallest rectangle that covers all farms has its bottom-left corner at (min{x1}, min{y1}) and its top-right corner at (max{x2}, max{y2}). The area of this rectangle is computed as:

\(\text{Area} = (\max(x2) - \min(x1)) \times (\max(y2) - \min(y1))\).

Your task is to output the area of this minimal rectangle.

inputFormat

The first line contains a single integer n denoting the number of farms. Each of the following n lines contains four integers x1 y1 x2 y2 — the coordinates of the bottom-left and top-right corners of a farm.

outputFormat

Output a single integer: the area of the smallest rectangle that covers all the farms.

sample

1
0 0 1 1
1

</p>