Codeforces Round #587 (Div. 3) C. White Sheet
链接:
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的更多相关文章
- Codeforces Round #587 (Div. 3)
https://codeforces.com/contest/1216/problem/A A. Prefixes 题意大概就是每个偶数位置前面的ab数目要相等,很水,被自己坑了 1是没看见要输出修改 ...
- 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 ...
- Codeforces Round #587 (Div. 3) D. Swords
链接: https://codeforces.com/contest/1216/problem/D 题意: There were n types of swords in the theater ba ...
- Codeforces Round #587 (Div. 3) B. Shooting(贪心)
链接: https://codeforces.com/contest/1216/problem/B 题意: Recently Vasya decided to improve his pistol s ...
- Codeforces Round #587 (Div. 3) A. Prefixes
链接: https://codeforces.com/contest/1216/problem/A 题意: Nikolay got a string s of even length n, which ...
- Codeforces Round #587 (Div. 3) F. Wi-Fi(单调队列优化DP)
题目:https://codeforces.com/contest/1216/problem/F 题意:一排有n个位置,我要让所有点都能联网,我有两种方式联网,第一种,我直接让当前点联网,花费为i,第 ...
- Codeforces Round #587 (Div. 3) F Wi-Fi(线段树+dp)
题意:给定一个字符串s 现在让你用最小的花费 覆盖所有区间 思路:dp[i]表示前i个全覆盖以后的花费 如果是0 我们只能直接加上当前位置的权值 否则 我们可以区间询问一下最小值 然后更新 #incl ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)
Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...
随机推荐
- rownum伪行号-排行榜-分页
rownum伪行号-排行榜-分页 1.rownum 是oracle数据库特有的一个特性,它针对每一个查询(包括子查询),都会生成一个rownum用于对该次查询进行编号 2.每个rownum只针对当前s ...
- Scala当中什么是Transformation和 Action,以及它们俩的区别是什么?
[学习笔记] 一个完整的RDD任务由两部分组成:Transformation和 Action.Transformation用于对RDD的创建,还可以把老的RDD通过Transformation来生成新 ...
- (三)mybatis 的使用(入门)
目录 mybatis 的使用 -- 准备 mybatis 的使用 -- 搭建好工程结构 mybatis 的使用 -- 创建 sqlMapCnfig.xml 全局配置文件 mybatis 的使用 -- ...
- Is It A Tree? POJ - 1308(并查集判树)
Problem Description A tree is a well-known data structure that is either empty (null, void, nothing) ...
- PHP接收前端传值各种情况整理
PHP接收前端传值各种情况整理 服务端代码: header('Access-Control-Allow-Origin:*'); var_dump($_POST); exit; 情况 1) 传null ...
- Delphi编译器属性(特别修饰符Ref,Unsafe,Volatile,Weak)
1 Refdelphi中常量参数就像一个本地常量,或者说只读变量.常量参数与值参数类似,除了不能在过程或函数体内给常量参数赋值,并且不能将常量参数传给另一个var类型参数.(但是,如果你常量参数传递的 ...
- 系统学习机器学习之神经网络(三)--GA神经网络与小波神经网络WNN
系统学习机器学习之神经网络(三)--GA神经网络与小波神经网络WNN 2017年01月09日 09:45:26 Eason.wxd 阅读数 14135更多 分类专栏: 机器学习 1 遗传算法1.1 ...
- SWATS算法剖析(自动切换adam与sgd)
SWATS算法剖析(自动切换adam与sgd) 战歌指挥官 搬砖.码砖.代查水表.... 27 人赞同了该文章 SWATS是ICLR在2018的高分论文,提出的一种自动由Adam切换为SGD而实现更好 ...
- javaIO——PushbackReader
1. 注释解释: A character-stream reader that allows characters to be pushed back into the stream. 一个允许字符被 ...
- wrbstrom使用
使用webstrom时遇到Firefox浏览器打不开问题,是webstrom未找到你Firefox的安装路径下面为大家提供解决方法: 文件--->设置--->工具--->web浏览器 ...