求调
  • 板块学术版
  • 楼主czx2021
  • 当前回复4
  • 已保存回复4
  • 发布时间2022/12/22 21:48
  • 上次更新2023/10/24 06:54:58
查看原帖
求调
565698
czx2021楼主2022/12/22 21:48

P2782 50pts

#include<bits/stdc++.h>
using namespace std;
int n,f[200000],ans,len;
struct node{
	int north,south;
}city[200000];
bool cmp(node x,node y)
{
	return x.north<y.north;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>city[i].north>>city[i].south;
	}
	sort(city,city+n+1,cmp);
	for(int i=1;i<=n;i++){
		int tmp=city[i].south;
		len=lower_bound(f+1,f+len+1,tmp)-f;
		f[len]=tmp;
		ans=max(ans,len);
	}
	cout<<ans;
	return 0;
}
2022/12/22 21:48
加载中...