链接:

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. [LuoguP2151][SDOI2009]HH去散步_递推_矩阵乘法_图论

    HH去散步 题目链接:https://www.luogu.org/problem/P2151 数据范围:略. 题解: 数据范围好小,让人不禁想用一些毒瘤算法,但是失败了. 这种类似时间啊这种有点重复味 ...

  2. [转帖]centos7上设置中文字符集

    centos7上设置中文字符集 https://www.cnblogs.com/kaishirenshi/p/10528034.html author: headsen  chen date: 201 ...

  3. Linux系列(12)之例行工作调度

    你知道工作调度有哪几种吗? 你知道在进行工作调度时需要哪些服务在运行吗? 你知道突发性工作调度的指令at的用法吗? 知道如何管理at的工作调度吗? 知道at指令进行工作调度的原理吗? 知道什么是背景任 ...

  4. Educational Codeforces Round 74 (Rated for Div. 2)补题

    慢慢来. 题目册 题目 A B C D E F G 状态 √ √ √ √ × ∅ ∅ //√,×,∅ 想法 A. Prime Subtraction res tp A 题意:给定\(x,y(x> ...

  5. Java打包

    打成jar包 如果你使用的是maven来管理项目,执行以下命令既可以 cd 项目跟目录(和pom.xml同级)mvn clean package## 或者执行下面的命令## 排除测试代码后进行打包mv ...

  6. 「网络流 24 题」最长 k 可重区间集

    给定区间集合$I$和正整数$k$, 计算$I$的最长$k$可重区间集的长度. 区间离散化到$[1,2n]$, $S$与$1$连边$(k,0)$, $i$与$i+1$连边$(k,0)$, $2n$与$T ...

  7. excel 导入

    public static DataTable ExcelToDataTable(string fileName, string sheetName, bool isFirstRowColumn) { ...

  8. 【css】浅谈BFC

    定义: 块格式化上下文(Block Formatting Context,BFC) 是Web页面的可视化CSS渲染的一部分,是块盒子的布局过程发生的区域,也是浮动元素与其他元素交互的区域. BFC的布 ...

  9. SQL学习——LIKE运算符

    原文链接 LIKE 作用 在WHERE子句中使用LIKE运算符来搜索列中的指定模式. 有两个通配符与LIKE运算符一起使用: % - 百分号表示零个,一个或多个字符 _ - 下划线表示单个字符 注意: ...

  10. ssh: Bad configuration option: usedns

    某天突然听到同事说服务器上git用不了了,上去一看,确实用不了了,git pull报出了如下错误: $ git pull /etc/: Bad configuration option: usedns ...