[NWRRC2014] Grave(模拟)

题面翻译

在一块长方形的墓地上,有一个长方形的教堂,现在给出一个长宽已知的墓碑,墓碑不能与教堂重叠,询问这块墓地上能否放下这块墓碑。

输入第一行两对坐标,代表墓地左下角和右上角的坐标(先 x x x 轴再 y y y 轴);
第二行也是两对坐标,代表教堂左下角和右上角的坐标(先 x x x 轴再 y y y 轴)(保证教堂完全在墓地内部且边缘不重叠);
第三行两个整数 w w w h h h,代表墓碑的长与宽,要求长度为 w w w 的一侧必须对应 x x x 轴,长度为 h h h 的一侧必须对应 y y y 轴。

输出一行一个字符串,如果放得下,输出 Yes,否则输出 No

题目描述

Gerard develops a Halloween computer game. The game is played on a rectangular graveyard with a rectangular chapel in it. During the game, the player places new rectangular graves on the graveyard. The grave should completely fit inside graveyard territory and should not overlap with the chapel. The grave may touch borders of the graveyard or the chapel.

Gerard asked you to write a program that determines whether it is possible to place a new grave of given size or there is no enough space for it.

输入格式

The first line of the input file contains two pairs of integers: x 1 , y 1 , x 2 , y 2 ( − 1 0 9 ≤ x 1 < x 2 ≤ 1 0 9 ; − 1 0 9 ≤ y 1 < y 2 ≤ 1 0 9 ) x_{1}, y_{1}, x_{2}, y_{2} (−10^{9} \le x_{1} < x_{2} \le 10^{9}; −10^{9} \le y_{1} < y_{2} \le 10^{9}) x1,y1,x2,y2(109x1<x2109;109y1<y2109) — coordinates of bottom left and top right corners of the graveyard. The second line also contains two pairs of integers x 3 , y 3 , x 4 , y 4 ( x 1 < x 3 < x 4 < x 2 ; y 1 < y 3 < y 4 < y 2 ) x_{3}, y_{3}, x_{4}, y_{4} (x_{1} < x_{3} < x_{4} < x_{2}; y_{1} < y_{3} < y_{4} < y_{2}) x3,y3,x4,y4(x1<x3<x4<x2;y1<y3<y4<y2) — coordinates of bottom left and top right corners of the chapel.

The third line contains two integers w , h w , h w,h — width and height of the new grave ( 1 ≤ w , h ≤ 1 0 9 ) . (1 \le w , h \le 10^{9}). (1w,h109). Side with length w w w should be placed along OX axis, side with length h h h — along OY axis.

输出格式

The only line of the output file should contain single word: Yes, if it is possible to place the new grave, or No, if there is not enough space for it.

样例 #1

样例输入 #1

1 1 11 8
2 3 8 6
3 2

样例输出 #1

Yes

样例 #2

样例输入 #2

1 1 11 8
2 3 8 6
4 3

样例输出 #2

No

提示

Time limit: 2 s, Memory limit: 256 MB.

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define inf 1e18
const int mod=1e9+7;
const int N=2e5+5;
void solve(){
	int x1,y1,x2,y2,x3,y3,x4,y4,w,h;
	cin>>x1>>y1>>x2>>y2;
	cin>>x3>>y3>>x4>>y4;
	cin>>w>>h;
	if((y2-y1)<h||(x2-x1)<w){
		cout<<"No";
		return;
	}
	int f=0;
	if((y3-y1)>=h) f=1;
	if((y2-y4)>=h) f=1;
	if((x3-x1)>=w) f=1;
	if((x2-x4)>=w) f=1;
	if(f) cout<<"Yes";
	else cout<<"No";
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int tt=1;
//	cin>>tt;
	while(tt--) solve();
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值