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 ... 
随机推荐
- src源dst目标
			dst是destination的缩写,表目的 src是source的缩写,表源 
- Codeforces696 Round #362 (Div. 1)(vp) A~D题解
			很久没有打比赛了,内部模拟赛天天垫底,第一次vp之旅又是和**一样,这样下去GDOI之后直接退役算了 整场都在忘开LL A. Lorenzo Von Matterhorn 这个题一看我就想直接虚树+树 ... 
- Appium——WebDriverException: Message: A new session could not be created.
			每次启动完一次脚本再次启动的时候会报这个错误,会话没有被创建 查看了下Appium日志: 查看下设备是否准备好,我用的是模拟器,就cmd下查看下设备: 可以看到设备掉线了... 好吧,重启下设备 脚本 ... 
- html页面表格导出到excel总结
			转载:http://www.cnblogs.com/liuguanghai/archive/2012/12/31/2840262.html <table id="tableExcel& ... 
- 关于URL编码的一些结论
			转载自:http://www.ruanyifeng.com/blog/2010/02/url_encoding.html与http://www.ruanyifeng.com/blog/2007/10/ ... 
- hdu-5673 Robot(默次金数)
			题目链接: Robot Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) 问题描述 ... 
- python sorted函数的小练习
			前两天学习了一下socket编程,在向某大神请教问题时被嫌弃了,有一种还没学会走就想跑的感觉.大神说我现在的水平应该去做一些像是操作文件.序列号等的小练习来加深理解.下面是他给我出的小练习: 1.da ... 
- CSS:CSS 网络安全字体组合
			ylbtech-CSS:CSS 网络安全字体组合 1.返回顶部 1. 常用的字体组合 font-family 属性应该使用若干种字体名称作为回退系统,以确保浏览器/操作系统之间的最大兼容性.如果浏览器 ... 
- vue-touchjs
			支持vue2.0的面向指令的touch指令,基于touchjs(原百度实现的移动端手势库) vue-touchjs支持三种stopPropagation的方式: 1 .stop修饰符 2 事件han ... 
- npm安装cnpm淘宝镜像
			npm set registry https://registry.npm.taobao.org # 注册模块镜像 npm set disturl https://npm.taobao.org/d ... 
