#include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int maxn = 100 + 5; /// 可能 是double struct node{ int x1, y1; int x2, y2; }; node a[maxn]; int x[maxn<<1], y[maxn<<1]; /// 存储所有的x, y坐标; int f[maxn<<2][maxn<<1]; int sum(){ sort(x, x+n); sort(y, y+n); memset(f, 0, sizeof(f)); /// 在主函数里清0 for(int h = 0; h < n; ++h) for(int i = 0; i < (n << 1); ++i){ if(x[i] >= a[h].x2) break; for(int j = 0; j < (n << 1); ++j){ if(y[j] >= a[h].y1) break; if(x[i] >= a[h].x1 && y[j] >= a[h].y2) f[i][j] = 1; } } int ans = 0; for(int i = 0; i < (n << 1); ++i) for(int j = 0; j < (n << 1); ++j) ans += f[i][j] * (x[i+1]-x[i]) * (y[j+1]-y[j]); return ans; } int main(){ int n; scanf("%d", &n); int indx = 0; for(int i = 0; i < n; ++i){ scanf("%d %d %d %d", &a[i].x1, &a[i].y1, &a[i].x2, &a[i].y2); x[indx] = a[i].x1; y[indx++] = a[i].y1; x[indx] = a[i].x2; y[indx++] = a[i].y2; } sort(x, x+indx);sort(y, y+indx); for(int h = 0; h < n; ++h) for(int i = 0; i < 2*n; ++i){ if(x[i] >= a[h].x2) break; for(int j = 0; j < 2*n; ++j){ if(y[j] >= a[h].y1) break; if(x[i] >= a[h].x1 && y[j] >= a[h].y2){ f[i][j]=1; } } } int area = 0; for(int i = 0; i < 2*n; ++i) for(int j = 0;j < 2*n; ++j) area += f[i][j] * (x[i+1]-x[i]) * (y[j+1]-y[j]); printf("%d\n", area); return 0; }