看到这个数据就可以直接二维涂色哈哈哈
AcWing 1761 阻挡广告牌
#include<bits/stdc++.h>
using namespace std;
const int N = 5010;
int an[N][N];//记录面积
int n;
int ans;
int maxx, maxy;
int main()
{
for(int i = 0; i < 2; i ++ ){
int x1, x2, y1, y2;
cin>>x1>>y1>>x2>>y2;
x1 += 1000;
x2 += 1000;
y1 += 1000;
y2 += 1000;
maxx = max(maxx, max(x1, x2));
maxy = max(maxy, max(y1, y2));
for(int j = x1; j < x2; j ++ ){
for(int k = y1; k < y2; k ++ ){
an[j][k] = 1;
}
}
}
int x3, x4, y3, y4;
cin>>x3>>y3>>x4>>y4;
x3 += 1000;
x4 += 1000;
y3 += 1000;
y4 += 1000;
maxx = max(maxx, max(x3, x4));
maxy = max(maxy, max(y3, y4));
for(int j = x3; j < x4; j ++ ){
for(int k = y3; k < y4; k ++ ){
an[j][k] = 3;
}
}
for(int i = 0; i <= maxx; i ++ ){
for(int j = 0; j <= maxy; j ++ ){
if(an[i][j] == 1){
ans ++ ;
}
//cout<<an[i][j]<<' ';
}
//cout<<endl;
}
cout<<ans<<endl;
return 0;
}