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 ...
随机推荐
- 简述arp协议的工作原理
在每台安装有TCP/IP协议的电脑里都有一个ARP缓存表,表里的IP地址与MAC地址是一一对应的,如: 我们以主机A(192.168.1.5)向主机B(192.168.1.1)发送数据为例.当发送数据 ...
- POJ1006 Biorhythms —— 中国剩余定理
题目链接:https://vjudge.net/problem/POJ-1006 Biorhythms Time Limit: 1000MS Memory Limit: 10000K Total ...
- Dubbo与Zookeeper、SpringMVC整合与使用(干货-理论放一遍。。。还未完结!)
Dubbo跟Zookeeper的简介分享两个不错的链接: Dubbo简介:http://shiyanjun.cn/archives/325.html Zookeeper简介:http://www.op ...
- mysql general log开启
#先查看当前状态 mysql> show variables like 'general%'; +------------------+----------------------------- ...
- Matlab小技巧之怎么复制汉字
在我们复制Matlab到Word的过程中,经常会出现乱码的情况.这时候可以这么做. 1.复制Matlab代码. 2.新建一个txt文件,将代码粘贴到txt文件中. 3.复制txt文件中的代码到Word ...
- 开发自己的composer包
1. 创建一个开发目录 mkdir project cd project 2. 利用composer生成一个composer.json composer init > Welcome to th ...
- Python之Numpy详细教程
NumPy - 简介 NumPy 是一个 Python 包. 它代表 “Numeric Python”. 它是一个由多维数组对象和用于处理数组的例程集合组成的库. Numeric,即 NumPy 的前 ...
- ceph之ceph-client安装
1.安装ceph-client ceph-deploy install ceph-client 2.创建块设备 [root@mon1 ~]# rbd create test1 --image-form ...
- JavaScript实现Select选择本周、上周、本季、上季、本年的时间选取
//转自http://blog.csdn.net/xc_young/article/details/16878849,其上季度有错误,已修改 var MrYangUtil = function () ...
- 管理SSIS 日志
转自:http://www.cnblogs.com/biwork/p/biworklog.html 一直准备写这么一篇有关 SSIS 日志系统的文章,但是发现很难一次写的很完整.因为这篇文章的内容可扩 ...