```cpp
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
struct contast
{
int start;
int end;
}c[1000100];
int n,i,j;
bool cmp(contast x,contast y)
{
return x.end<y.end || (x.end==y.end && x.start<y.start);//排序函数改一下
}
int main()
{
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%d",&c[i].start,&c[i].end);
}
sort(c+1,c+1+n,cmp);
int t=1,tt=1,j=1;
for(j=1;j<n;j++)
{
if(c[j].start<c[tt].end)continue;
else
{
tt=j;
t++;
}
}
printf("%d",t);
return 0;
}
@[acacqac](/space/show?uid=22260) 改成这样就行了:
```
by Mr_QwQ @ 2017-08-28 16:04:47
@[fzkfqzz](/space/show?uid=30261) 谢谢
by acacqac @ 2017-09-25 11:54:18