提交时间:2023-04-08 10:26:48
运行 ID: 73657
#include<bits/stdc++.h> using namespace std; int n,k; int tmp[111111]; struct club { int a,b; }clubs[111111]; bool cmp(club x,club y) { return x.a<y.a; } int main() { cin>>n; for(int i=1;i<=n;i++) cin>>clubs[i].a>>clubs[i].b; sort(clubs+1,clubs+1+n,cmp); for(int i=1;i<=n;i++) { tmp[i]=1; for(int j=1;j<i;j++) if(clubs[i].b>clubs[j].b&&clubs[i].a!=clubs[j].a) tmp[i]=max(tmp[j]+1,tmp[i]); } for(int i=1;i<=n;i++) k=max(tmp[i],k); cout<<k; }