unknow error
查看原帖
unknow error
796403
sandwich03楼主2024/5/2 15:42
#include<bits/stdc++.h>
using namespace std;
struct xxx{
	int a,b;
}p[101000];
int n,m;
bool cmp(xxx &a, xxx &b){
	return a.b<b.b;
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=m;i++)
		cin>>p[i].a>>p[i].b;
	sort (p+1,p+m+1,cmp);
	int lst=1,ans=0;
	for(int i=1;i<=m;i++)
	{
		if(p[i].a>=lst){
			lst=p[i].b;
			ans++;
		}
	}
	cout<<ans;//3
	return 0;
}
2024/5/2 15:42
加载中...