Codeforces Round #497 (Div. 2)B. Turn the Rectangles
http://codeforces.com/contest/1008/problems
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MAXN=1e5+10;
const int INF=0x3f3f3f3f;
struct REC
{
int w,h;
}rec[MAXN];
int n;
int main()
{
//cout << "Hello world!" << endl;
cin>>n;
rec[0].h=INF;
bool flag=true;
for(int i=1;i<=n;i++)
{
cin>>rec[i].w>>rec[i].h;
if(max(rec[i].w,rec[i].h)<=rec[i-1].h)
rec[i].h=max(rec[i].w,rec[i].h);
else if(min(rec[i].w,rec[i].h)<=rec[i-1].h)
rec[i].h=min(rec[i].w,rec[i].h);
else if(min(rec[i].w,rec[i].h)>rec[i-1].h)
flag=false;
}
if(flag)
cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}
Codeforces Round #497 (Div. 2)B. Turn the Rectangles的更多相关文章
- Codeforces Round #497 (Div. 2)
Codeforces Round #497 (Div. 2) https://codeforces.com/contest/1008 A #include<bits/stdc++.h> u ...
- Codeforces Round #497 (Div. 2) C. Reorder the Array
Bryce1010模板 http://codeforces.com/contest/1008/problems #include <bits/stdc++.h> using namespa ...
- Codeforces Round #497 (Div. 2) A. Romaji
Bryce1010模板 http://codeforces.com/contest/1008/problems #include <bits/stdc++.h> using namespa ...
- Codeforces Round #395 (Div. 2) D. Timofey and rectangles
地址:http://codeforces.com/contest/764/problem/D 题目: D. Timofey and rectangles time limit per test 2 s ...
- 【分类讨论】Codeforces Round #395 (Div. 2) D. Timofey and rectangles
D题: 题目思路:给你n个不想交的矩形并别边长为奇数(很有用)问你可以可以只用四种颜色给n个矩形染色使得相接触的 矩形的颜色不相同,我们首先考虑可不可能,我们分析下最多有几个矩形互相接触,两个时可以都 ...
- Codeforces Round #223 (Div. 2) A
A. Sereja and Dima time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces Codeforces Round #484 (Div. 2) E. Billiard
Codeforces Codeforces Round #484 (Div. 2) E. Billiard 题目连接: http://codeforces.com/contest/982/proble ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
随机推荐
- ubuntu12.04不能记住上次编辑位置的解决方案
1:按照网上的代码 au BufReadPost * |if line("'\"") <= line("$")|exe("norm ' ...
- Vue.js的动态组件模板
组件并不总是具有相同的结构.有时需要管理许多不同的状态.异步执行此操作会很有帮助. 实例: 组件模板某些网页中用于多个位置,例如通知,注释和附件.让我们来一起看一下评论,看一下我表达的意思是什么.评论 ...
- HDU2512 一卡通大冒险 —— 第二类斯特林数
题目链接:https://vjudge.net/problem/HDU-2512 一卡通大冒险 Time Limit: 2000/1000 MS (Java/Others) Memory Lim ...
- Program received signal SIGSEGV, Segmentation fault.
GDB调试的时候出现了: Program received signal SIGSEGV, Segmentation fault.(程序收到信号SIGSEGV,分段故障) SIGSEGV:在POSIX ...
- 图片预览JavaScript方法
实现要点 ● 对于 Chrome.Firefox.IE10 使用 FileReader 来实现. ● 对于 IE6~9 使用滤镜 filter:progid:DXImageTransform.Mi ...
- 在一个form表单中根据不同按钮实现多个action事件
<form id="writeForm" method="post"> <div class="write-btn-tj" ...
- HBase之四--(3):hbasehbase分页查询
为了广大技术爱好者学习netty,在这里帮新浪微博@nettying宣传下他出版的新书 <netty权威指南>@nettying兄在华为NIO实践多年,这本书是他的技术和经验的一个结晶.N ...
- bzoj3489
kdtree 3维kdtree,就是三个维度轮换着切,我们把每个元素看成一个点,坐标是上次出现的位置,下次出现的位置,自己的位置,第一个<l,第二个>r,第三个[l,r],然后kdtree ...
- Spring-SpringMVC-Mybatis实例
源码下载:https://pan.baidu.com/s/1kUK7qYj 提取码:3mgb 最近在学习SSM框架,先讲一下这三大框架都有什么作用. SpringMVC: 它用于web层,相当于 ...
- 理解复杂的const和typedef和指针的关系
// container.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<iostream> #inclu ...