Codeforces845C
来源:互联网 发布:书法集字软件 编辑:程序博客网 时间:2024/05/28 03:03
扫描线的简单运用。
#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef pair<int, int> P;const int N = 2E5 + 7;vector<P> a;int n;int main(){ std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin >> n; for(int i = 1;i <= n;i ++) { int l, r; cin >> l >> r; a.push_back(make_pair(l, 1)); a.push_back(make_pair(r + 1, -1)); } sort(begin(a), end(a)); int cnt = 0; for(auto it : a) { cnt += it.second; if(cnt > 2) { cout << "NO" << endl ; return 0; } } cout << "YES" << endl; return 0;}
阅读全文
0 0
- Codeforces845C
- codeforces845C(stl)
- 进程间通信的方式
- 初步认识JVM
- JAVA操作Hbase管理类HbaseManage基本详细操作
- java每日一练
- echarts仪表盘(ie8中0显示异常)
- Codeforces845C
- Android Service的bindService和startService混合使用及其关闭分析
- JAVA学习57_ Java千百问_02基本使用(003)_不使用IDE如何打jar包
- python 经典100例 (61-80)
- jquery validate 的自定义验证开始时间不能大于结束时间
- parallel studio xe 2017 update4 编译器套件学生版下载及密钥的申请
- 【NOI2004】郁闷的出纳员(splay)
- 排序算法-交换排序之快速排序
- 简单的程序诠释C++ STL算法:copy