上饶有哪些做网站的店,商标注册号怎么申请,化工厂建设网站,phpcms 移动网站模板传送门 文章目录题意#xff1a;思路#xff1a;题意#xff1a;
给你一个白色的矩形和俩个黑色的矩形#xff0c;问白色被黑色覆盖后还能不能看到。
思路#xff1a;
经典被简单题卡。 一开始写了个自我感觉很对的做法#xff0c;结果wa41wa41wa41#xff0c;检查不…传送门
文章目录题意思路题意
给你一个白色的矩形和俩个黑色的矩形问白色被黑色覆盖后还能不能看到。
思路
经典被简单题卡。 一开始写了个自我感觉很对的做法结果wa41wa41wa41检查不出来只能换思路了。 考虑一个容斥我们算出来第一个黑色矩形覆盖的面积再算第二个黑色矩形覆盖的面积让后减去两个覆盖的矩形的面积交。此时就是黑色矩形覆盖白色的总面积只需要算出白色的面积让后看看是否等于即可。
// Problem: C. White Sheet
// Contest: Codeforces - Codeforces Round #587 (Div. 3)
// URL: https://codeforces.com/contest/1216/problem/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)//#pragma GCC optimize(Ofast,no-stack-protector,unroll-loops,fast-math)
//#pragma GCC target(sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tunenative)
//#pragma GCC optimize(2)
#includecstdio
#includeiostream
#includestring
#includecstring
#includemap
#includecmath
#includecctype
#includevector
#includeset
#includequeue
#includealgorithm
#includesstream
#includectime
#includecstdlib
#includerandom
#includecassert
#define X first
#define Y second
#define L (u1)
#define R (u1|1)
#define pb push_back
#define mk make_pair
#define Mid ((tr[u].ltr[u].r)1)
#define Len(u) (tr[u].r-tr[u].l1)
#define random(a,b) ((a)rand()%((b)-(a)1))
#define db puts(---)
using namespace std;//void rd_cre() { freopen(d://dp//data.txt,w,stdout); srand(time(NULL)); }
//void rd_ac() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//AC.txt,w,stdout); }
//void rd_wa() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//WA.txt,w,stdout); }typedef long long LL;
typedef unsigned long long ULL;
typedef pairint,int PII;const int N4000010,mod1e97,INF0x3f3f3f3f;
const double eps1e-6;int x[N],y[N];pairPII,PII solve(PII a,PII b,PII c,PII d) {int lxmax(a.X,c.X),rxmin(b.X,d.X);int lymax(a.Y,c.Y),rymin(b.Y,d.Y);if(lxrx||lyry) return {{0,0},{0,0}};return {{lx,ly},{rx,ry}};
}LL getarea(pairPII,PII now) {return 1ll*(now.X.X-now.Y.X)*(now.X.Y-now.Y.Y);
}int main()
{
// ios::sync_with_stdio(false);
// cin.tie(0);int x1,y1,x2,y2; cinx1y1x2y2;int x3,y3,x4,y4; cinx3y3x4y4;int x5,y5,x6,y6; cinx5y5x6y6;pairPII,PII now1solve({x1,y1},{x2,y2},{x3,y3},{x4,y4});pairPII,PII now2solve({x1,y1},{x2,y2},{x5,y5},{x6,y6});pairPII,PII now3solve(now1.X,now1.Y,now2.X,now2.Y);LL ans1getarea(now1),ans2getarea(now2),ans3getarea(now3);if(getarea({{x1,y1},{x2,y2}})ans1ans2-ans3) puts(YES);else puts(NO);return 0;
}
/**/