#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1010;
pair<int, int> act[N];
int n;
int main()
{
cin >> n;
for(int i = 0; i < n; i ++ )
cin >> act[i].second >> act[i].first;
sort(act, act + n);
int res = 0,ed = -9;
for(int i = 0; i < n; i ++ )
if(act[i].second >= ed)
ed = act[i].first, res ++ ;
cout << res << endl;
return 0;
}
西工大算法设计与分析 noj1205 活动安排(实验四)
最新推荐文章于 2021-10-25 01:20:58 发布