Combined rectangles
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Combining rectangles is much easier when its sides are parallel to the coordinate axes. Find the total area covered by a given set of rectangles.
Input
The first line contains the number of rectangles n (2 ≤ n ≤ 3). Each of the next n lines contains coordinates of opposite corners of rectangle in format: x[1] y[1] x[2] y[2]
. The coordinates are integers in the range [-10^9
, 10^9
].
The rectangles can be degenerated.
Output
Print the total area covered by the given set of rectangles, rounded to the nearest integer.
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Input #4
Answer #4
Submissions 60
Acceptance rate 60%