Home => ProblemSet => 3.2-22:矩形面积并
Problem1866--3.2-22:矩形面积并

1866: 3.2-22:矩形面积并

Time Limit: 1 Sec  Memory Limit: 128 MB  Submit: 0  Solved: 3
[ Submit ] [ Status ] [ Creator: ][ 参考程序 ]

Description

求 n 个四边平行于坐标轴的矩形的面积并。

Input

第一行一个正整数 n。
接下来 n 行每行四个非负整数 x1,y1,x2,y2,表示一个矩形的四个端点坐标为 (x1,y1),(x1,y2),(x2,y2),(x2,y1)。

Output

一行一个正整数,表示 n 个矩形的并集覆盖的总面积。

Sample Input Copy

2
100 100 200 200
150 150 250 255

Sample Output Copy

18000

HINT

对于 20% 的数据, 1≤n≤1000。
对于 100% 的数据, 1≤n≤105, 0≤x1<x2≤109, 0≤y1<y2≤109