Problem G. Grave

题目连接:

http://codeforces.com/gym/100531/attachments

Description

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.

Input

The first line of the input file contains two pairs of integers: x1, y1, x2, y2 (−109 ≤ x1 < x2 ≤ 109

;

−109 ≤ y1 < y2 ≤ 109

) — coordinates of bottom left and top right corners of the graveyard. The second

line also contains two pairs of integers 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 — width and height of the new grave (1 ≤ w, h ≤ 109

). Side

with length w should be placed along OX axis, side with length h — along OY axis

Output

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.

Sample Input

1 1 11 8

2 3 8 6

3 2

Sample Output

Yes

Hint

题意

有一个矩形,然后在里面放一个矩阵,问你还能不能再放进去一个w*h的矩阵进去

题解:

水题,只有四个空位子,把这四个位置都判断一下就好

代码

#include<bits/stdc++.h>
using namespace std; int x1,y1,x2,y2;
int x3,y3,x4,y4;
int w,h;
int main()
{
freopen("grave.in","r",stdin);
freopen("grave.out","w",stdout);
cin>>x1>>y1>>x2>>y2;
cin>>x3>>y3>>x4>>y4;
cin>>w>>h;
int l = x2 - x1;
int H = y2 - y1;
if(l>=w&&y3-y1>=h)
return puts("Yes");
if(l>=w&&y2-y4>=h)
return puts("Yes");
if(H>=h&&x3-x1>=w)
return puts("Yes");
if(H>=h&&x2-x4>=w)
return puts("Yes");
return puts("No");
}

Codeforces Gym 100531G Grave 水题的更多相关文章

  1. Gym 100531G Grave(水题)

    题意:给定一个大矩形,再给定在一个小矩形,然后给定一个新矩形的长和高,问你能不能把这个新矩形放到大矩形里,并且不与小矩形相交. 析:直接判定小矩形的上下左右四个方向,能不能即可. 代码如下: #pra ...

  2. Codeforces Gym 100286I iSharp 水题

    Problem I. iSharpTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  3. CodeForces Gym 100685C Cinderella (水题)

    题意:给定 n 个杯子,里面有不同体积的水,然后问你要把所有的杯子的水的体积都一样,至少要倒少多少个杯子. 析:既然最后都一样,那么先求平均数然后再数一下,哪个杯子的开始的体积就大于平均数,这是一定要 ...

  4. codeforces 706A A. Beru-taxi(水题)

    题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...

  5. codeforces 569B B. Inventory(水题)

    题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  6. Codeforces 489A SwapSort (水题)

    A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  7. UVaLive 6591 && Gym 100299L Bus (水题)

    题意:略. 析:不解释,水题. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include < ...

  8. codeforces 688A A. Opponents(水题)

    题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  9. CodeForces 534B Covered Path (水题)

    题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代 ...

随机推荐

  1. LoadRunner error -27979

    4.LoadRunner请求无法找到:在录制Web协议脚本回放脚本的过程中,会出现请求无法找到的现象,而导致脚本运行停止.错误现象:Action.c(41): Error -27979: Reques ...

  2. VC6.0到VS2013全部版本下载地址

    Microsoft Visual Studio 6.0 下载:英文版360云盘下载: http://l11.yunpan.cn/lk/sVeBLC3bhumrI英文版115网盘下载: http://1 ...

  3. 《深入理解C#》第3版 学习进度备忘

    学习资源:<深入理解C#>第3版 知识基础支持: <C# in a nutshell> O Reilly出版社,是一本从头介绍C#的优秀图书.<Essential C#5 ...

  4. c++数组、字符串操作

    一.数组操作 1.数组初始化1-1一维数组初始化:标准方式一: int value[100]; // value[i]的值不定,没有初始化标准方式二: int value[100] = {1,2}; ...

  5. poj2528(线段树+离散化)Mayor's posters

    2016-08-15 题意:一面墙,往上面贴海报,后面贴的可以覆盖前面贴的.问最后能看见几种海报. 思路:可以理解成往墙上涂颜色,最后能看见几种颜色(下面就是以涂色来讲的).这面墙长度为1~1000 ...

  6. iOS 获取通讯录权限的时机

    建议将获取通讯录权限的代码放到 -(void)viewDidAppear:(BOOL)animated 或 -(void)viewWillAppear:(BOOL)animated 假如放在 view ...

  7. URAL-1987 Nested Segments 线段树简单区间覆盖

    题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1987 题意:给定n条线段,每两条线段要么满足没有公共部分,要么包含.给出m个询问,求当前 ...

  8. openstack network

  9. VS2010 删除空行

    查找内容:^:b*$\n 替换为: 查找范围:当前文档 使用:正则表达式 vs2013 ^\s*(?=\r?$)\n

  10. 解决Ubuntu系统的每次开机重启后,resolv.conf清空的问题

    问题情况描述如下: 普及知识:   /etc/resolv.conf ,其实是一个Link .它其实指向的是 /run/resolvconf/resolv.conf.  Ubuntu 有一个 reso ...