10^6是一百万,你只开十万,肯定RE啊
by neocoding @ 2024-07-01 16:36:46
@[yangxingjie08](/user/1209719)
```
#include<bits/stdc++.h>
using namespace std;
struct pp{
int o,q,time;
}a[1000005];
bool cmp(pp a,pp b){
if(a.o<b.o) return 1;
return 0;
}
int main(){
int n,jsq=0,nowr=-1;
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i].o>>a[i].q,a[i].q--;
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;i++){
if(a[i].o>nowr) jsq++,nowr=a[i].q;
if(a[i].q<nowr) nowr=a[i].q;
}
cout<<jsq;
return 0;
}
```
by BlackWuKong @ 2024-07-10 11:23:08