SGU 133 Border 排序+枚举
来源:互联网 发布:初等数论难题集淘宝 编辑:程序博客网 时间:2024/04/29 07:37
Sol:就是双关键字排序,枚举一下符合题意的就OK了。
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn = 16000 + 10;struct Point{int x,y;}arr[maxn];bool cmp(const Point &a,const Point &b){return (a.x<b.x||a.x==b.x&&a.y<b.y);}int main(){int n,j,cnt;scanf("%d",&n);for(int i=0;i<n;i++)scanf("%d%d",&arr[i].x,&arr[i].y);sort(arr,arr+n,cmp);j=0;cnt=1;for(int i=1;i<n;i++){if(arr[i].x==arr[i].y||arr[i].y>=arr[j].y){j=i;cnt++;}}printf("%d\n",n-cnt);return 0;}
0 0
- SGU 133 Border 排序+枚举
- sgu 133 Border
- SGU: 133 Border
- sgu-133 Border
- SGU 133 Border(水~)
- SGU - 133 - Border (简单统计)
- [SGU]133. Border
- SGU 133. Border
- sgu 142Keyword 枚举
- SGU 537 Divisibility 枚举
- SGU 133. Border 最小区间覆盖
- SGU 230 拓扑排序
- SGU 133
- sgu 133
- SGU 532 Building Foundation(枚举)
- sgu 148 B-Station 枚举+小根堆
- SGU 158 Commuter Train(暴力+枚举)
- SGU 119. Magic Pairs 同余+枚举
- iOS7应用开发15:嵌入型segue
- ios中使用FMDB的几个小问题
- winsock 地址结构
- JAX-RS入门 八: HTTP响应
- Fox Graphics Library - High-performance 3D graphics application framework
- SGU 133 Border 排序+枚举
- webbrowser控件代码
- range 对象应用(上)
- 项目团队中的冲突是项目进程中的必然现象
- JAX-RS入门 九: 内容约定(1)
- 产品定位五步法
- JAX-RS入门 九: 内容约定(2)
- 基于visual Studio2013解决面试题之0506取和为m的可能组合
- Bug管理系统UML2.0建模实例(二)