Rectangles
Time limit3sMemory limit128 MB
Given N axis-aligned rectangles, compute the area of their union.
- Level
Hard8 of 10
- Topics
- Segment tree, Sorting, Prefix sum
- Solved
- No attempts yet
Problem
There are axis-aligned rectangles placed on the plane. Write a program that computes the total area of the region covered by these rectangles. A region covered by several rectangles at once is counted only once.
Input
The first line contains a positive integer . ()
Each of the next lines contains four integers , , , separated by spaces, describing the rectangle .
All coordinates are integers with and .
Output
Print the total area of the region covered by the rectangles.