标签:space second sheet fine begin define 模拟 amp bit
虽然分类讨论应该是比较推崇的解法,但是我就是喜欢暴力
#include <bits/stdc++.h>
using namespace std;
#define int long long
int a[20][20];
map <int,int> mx,my;
int idx,idy;
int x[9],y[9];
void fillrect(int x1,int y1,int x2,int y2,int v) {
//cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
for(int i=x1;i<=x2;i++)
for(int j=y1;j<=y2;j++)
a[i][j]=v;
}
signed main() {
for(int i=1;i<=6;i++) scanf("%d%d",&x[i],&y[i]);
for(int i=1;i<=6;i++) (x[i]*=2),(y[i]*=2);
for(int i=1;i<=6;i++) {
mx[x[i]]++;mx[x[i]-1]++;mx[x[i]+1]++;
my[y[i]]++;my[y[i]-1]++;my[y[i]+1]++;
}
for(map<int,int>::iterator it=mx.begin();it!=mx.end();it++)
it->second=++idx;
for(map<int,int>::iterator it=my.begin();it!=my.end();it++)
it->second=++idy;
for(int i=1;i<=6;i++) {
x[i]=mx[x[i]];
y[i]=my[y[i]];
}
fillrect(x[1],y[1],x[2],y[2],1);
fillrect(x[3],y[3],x[4],y[4],0);
fillrect(x[5],y[5],x[6],y[6],0);
int flag=0;
for(int i=1;i<=idx;i++)
for(int j=1;j<=idy;j++)
flag+=a[i][j];
cout<<(flag?"YES":"NO")<<endl;
return 0;
}
[CF1216C] White Sheet - 离散化,模拟
标签:space second sheet fine begin define 模拟 amp bit
原文地址:https://www.cnblogs.com/mollnn/p/12267296.html