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 ...
随机推荐
- 利用javascript动态创建表格
//说明:实现功能.原理上文相同.不过这次是利用已有的简单的方法创建行和列,并实现内容行鼠标移入变色功能! 效果图: /*两个方法 1. trNode table.insertRow(-1) ...
- tflearn 数据集太大无法加载进内存问题?——使用image_preloader 或者是 hdf5 dataset to deal with that issue
tflearn 数据集太大无法加载进内存问题? Hi, all! I'm trying to train deep net on a big dataset that doesn't fit into ...
- requireJS 加载css、less文件
-- requireJS 同样可以加载css 文件,有require-css的插件,只需要把插件放入main.js同文件夹,在依赖处 采用 ‘css! test.css’的形式就可以加载css文件 - ...
- [TJOI 2018] XOR
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=5338 [算法] 首先对这棵树进行树链剖分 那么我们就将一个树上的问题转化为一个序列上 ...
- dcos下rexray服务的配置
在dcos环境下,rexray服务的默认配置文件为/opt/mesosphere/etc/rexray.conf,而其服务文件则是 /etc/systemd/system/dcos-rexray.se ...
- bzoj3625
fft 分治虽然是万能的,但是太慢了 分治是nlog^2n的,太慢了,于是我们用求逆和开根 设f(x)表示答案为x的方案数 c表示物品的生成函数 那么f=f*f*c+1 f*f表示左右儿子的方案数 c ...
- MVC 登录后重定向回最初请求的 URL FormsAuthentication.RedirectFromLoginPage
在传统的Asp.net webForm 中如果使用 Form身份验证.登录后重定向到最初请求的页面只需使用 FormsAuthentication.RedirectFromLoginPage 但在MV ...
- python 中main函数总结
Python使用缩进对齐组织代码的执行,所有没有缩进的代码(非函数定义和类定义),都会在载入时自动执行,这些代码,可以认为是Python的main函数. 每个文件(模块)都可以任意写一些没有缩进的代码 ...
- Flutter实战视频-移动电商-47.详细页_Flutter_html插件的使用
47.详细页_Flutter_html插件的使用 详情里面是hemlt和图片组成的,但是flutter是不支持html的所以需要其他插件 flutter webview plugin:这个不太好用 f ...
- vue中循环时动态绑定值
在vue项目中,有很多需要动态循环绑定的场景,在未知绑定数量的情况下只能动态生成绑定值 1.首先在data中定义一个对象,我在项目中时循环绑定下拉框,所以定义了一个selectVal = {} 2.在 ...