链接:

https://codeforces.com/contest/1216/problem/C

题意:

There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume that the bottom left corner of the table has coordinates (0,0), and coordinate axes are left and bottom sides of the table, then the bottom left corner of the white sheet has coordinates (x1,y1), and the top right — (x2,y2).

After that two black sheets of paper are placed on the table. Sides of both black sheets are also parallel to the sides of the table. Coordinates of the bottom left corner of the first black sheet are (x3,y3), and the top right — (x4,y4). Coordinates of the bottom left corner of the second black sheet are (x5,y5), and the top right — (x6,y6).

Example of three rectangles.

Determine if some part of the white sheet can be seen from the above after the two black sheets are placed. The part of the white sheet can be seen if there is at least one point lying not strictly inside the white sheet and strictly outside of both black sheets.

思路:

每次加进来的矩形, 就维护原来的矩形两个位置, 最后判断是否满足即可.

代码:

#include <bits/stdc++.h>
using namespace std; int main()
{
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
for (int i = 1;i <= 2;i++)
{
int X1, Y1, X2, Y2;
cin >> X1 >> Y1 >> X2 >> Y2;
if (x1 >= X1 && x2 <= X2)
{
if (y1 >= Y1)
y1 = max(y1, Y2);
if (y2 <= Y2)
y2 = min(y2, Y1);
}
if (y1 >= Y1 && y2 <= Y2)
{
if (x1 >= X1)
x1 = max(x1, X2);
if (x2 <= X2)
x2 = min(x2, X1);
}
}
if (x1 >= x2 && y1 >= y2)
puts("NO");
else
puts("YES"); return 0;
}

Codeforces Round #587 (Div. 3) C. White Sheet的更多相关文章

  1. Codeforces Round #587 (Div. 3)

    https://codeforces.com/contest/1216/problem/A A. Prefixes 题意大概就是每个偶数位置前面的ab数目要相等,很水,被自己坑了 1是没看见要输出修改 ...

  2. Codeforces Round #587 (Div. 3) C题 【判断两个矩形是否完全覆盖一个矩形问题】 {补题 [差点上分系列]}

    C. White Sheet There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle ...

  3. Codeforces Round #587 (Div. 3) D. Swords

    链接: https://codeforces.com/contest/1216/problem/D 题意: There were n types of swords in the theater ba ...

  4. Codeforces Round #587 (Div. 3) B. Shooting(贪心)

    链接: https://codeforces.com/contest/1216/problem/B 题意: Recently Vasya decided to improve his pistol s ...

  5. Codeforces Round #587 (Div. 3) A. Prefixes

    链接: https://codeforces.com/contest/1216/problem/A 题意: Nikolay got a string s of even length n, which ...

  6. Codeforces Round #587 (Div. 3) F. Wi-Fi(单调队列优化DP)

    题目:https://codeforces.com/contest/1216/problem/F 题意:一排有n个位置,我要让所有点都能联网,我有两种方式联网,第一种,我直接让当前点联网,花费为i,第 ...

  7. Codeforces Round #587 (Div. 3) F Wi-Fi(线段树+dp)

    题意:给定一个字符串s 现在让你用最小的花费 覆盖所有区间 思路:dp[i]表示前i个全覆盖以后的花费 如果是0 我们只能直接加上当前位置的权值 否则 我们可以区间询问一下最小值 然后更新 #incl ...

  8. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  9. Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)

    Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...

随机推荐

  1. poj1915(双向bfs)

    题目链接:https://vjudge.net/problem/POJ-1915 题意:求棋盘上起点到终点最少的步数. 思路:双向广搜模板题,但玄学的是我的代码G++会wa,C++过了,没找到原因QA ...

  2. HTML 全局属性 = HTML5 中添加的属性。

    属性 描述 accesskey 规定激活元素的快捷键. class 规定元素的一个或多个类名(引用样式表中的类). contenteditable 规定元素内容是否可编辑. contextmenu 规 ...

  3. oracle中表记录被另一个用户锁住

    应用场景 在查询oracle表时,提示表记录被另一个用户锁住了 有可能是在使用了pl/sql工具后修改某个表记录时,加锁,或者发生故障异常退出,下次登录进去修改不了 查询锁 --查看数据库的锁的来源. ...

  4. 剑指offer34:第一个只出现一次的字符的位置

    1 题目描述 在一个字符串(0<=字符串长度<=10000,全部由字母组成)中找到第一个只出现一次的字符,并返回它的位置, 如果没有则返回 -1(需要区分大小写). 2 思路和方法 ch[ ...

  5. 基于LINUX下的进程管理问题

    什么是进程? 程序(program)放置在存储媒体中(如硬盘,光盘,软盘,磁带等)为实体文件的形态存在 进程:程序被触发后,执行者的权限与属性,程序的程序码与所需数据等都会被载入内存中,操作系统并给予 ...

  6. Grace模式、Saint模式

    一.probe(后端探针) 探测后端,确定他们是否健康,返回的状态用req.backend.healthy核对 backend b1 { .host = "127.0.0.1"; ...

  7. 怎样指定当前cookie不能通过js脚本获取

    所谓" 不能通过js脚本获取 " 主要指的是: 使用document.cookie / XMLHttpRequest对象 / Request API 等无法获取到当前cookie. ...

  8. C++反汇编第五讲,认识C++中的Try catch语法,以及在反汇编中还原

    我们以前讲SEH异常处理的时候已经说过了,C++中的Try catch语法只不过是对SEH做了一个封装. 如果不懂SEH异常处理,请点击博客链接熟悉一下,当然如果不想知道,也可以直接往下看.因为异常处 ...

  9. Python 数字(函数)

    Python支持4种不同数值类型: 整型(Int) - 通常被称为是整型或整数,是正或负整数,不带小数点. 长整型(long integers) - 无限大小的整数,整数最后是一个大写或小写的L. 浮 ...

  10. IEnumerable<T>和IQuryable<T>的区别

    https://stackoverflow.com/questions/1578778/using-iqueryable-with-linq/1578809#1578809 The main diff ...