Union of rectangles 2
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 122.486 megabytes
Union of rectangles is much easier when their sides are parallel to the coordinate axes. Find the union of the given set of rectangles.
Input
The first line contains the number of rectangles n (2 ≤ n ≤ 15). Each of the next n lines gives the coordinates of opposite corners of one rectangle in format x[1] y[1] x[2] y[2]
. All coordinates are integers and belongs to segment [-10^9
, 10^9
].
The rectangles can be irregular.
Output
Print the area of union of rectangles.
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Input #4
Answer #4
Submissions 59
Acceptance rate 59%