ural 1203. Scientific Conference
2014-03-28 16:50
316 查看
http://acm.timus.ru/problem.aspx?space=1&num=1203
View Code
#include <cstdio> #include <cstring> #include <algorithm> #define maxn 400000 using namespace std; struct node { int s,e; bool operator <(const node &a)const { return ((e<a.e)||(e==a.e&&s>a.s)); } }p[maxn]; int dp[maxn]; int main() { int n; scanf("%d",&n); for(int i=1; i<=n; i++) { scanf("%d%d",&p[i].s,&p[i].e); } sort(p+1,p+n+1); int e=0,s=0; int cnt=0; for(int i=1; i<=n; i++) { if(p[i].s>=s) { s=p[i].e+1; cnt++; } } printf("%d\n",cnt); return 0; }
View Code
相关文章推荐
- Ural 1109 Conference(匈牙利算法·转换)
- Ural-1109-Conference
- Ural1109 Conference(二分图匹配)
- 【图论】【二分图匹配】[Ural 1109]Conference
- Ural1109_Conference(二分图最大匹配/匈牙利算法/网络最大流)
- Ural1109_Conference(二分图最大匹配/匈牙利算法/网络最大流)
- Ural 1109 Conference(最小路径覆盖数)
- URAL 1203 Scientific Conference dp练习
- ural 1203. Scientific Conference
- ural 1109 Conference (二分图匹配)
- URAL 1354 Palindrome. Again Palindrome (回文 + KMP)
- ural 1343. Fairy Tale
- URAL 1225 Flags 简单DP,一重循环
- ural 1145. Rope in the Labyrinth
- Ural1960 Palindromes and Super Abilities
- URAL 1533 Fat Hobbits
- URAL 1796. Amusement Park (math)
- ural 2071. Juice Cocktails
- 【Ural1167】 Bicolored Horses——基础Dp
- URAL 1786 Sandro's Biography