Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
32579 | hi_hi | 【S】T3 | C++ | 运行超时 | 0 | 4000 MS | 2852 KB | 1798 | 2024-09-15 13:50:23 |
#include<bits/stdc++.h> using namespace std; #define ll long long const int N=1e5+10; int n,m1,m2; struct plane{ int st,ed,fl; }gn[N],gj[N]; int f1[N],f2[N]; int lylak[N]; int cs,cnt,pre; int ans; bool cmp(plane x,plane y){ return x.st<y.st; } signed main(){ // freopen("airport.in","r",stdin); // freopen("airport.out","w",stdout); scanf("%d%d%d",&n,&m1,&m2); for(int i=1;i<=m1;i++){ scanf("%d%d",&gn[i].st,&gn[i].ed); gn[i].fl=1; } for(int i=1;i<=m2;i++){ scanf("%d%d",&gj[i].st,&gj[i].ed); gj[i].fl=1; } sort(gn+1,gn+1+m1,cmp); sort(gj+1,gj+1+m2,cmp); cs=1,cnt=1; f1[1]=1; pre=gn[1].ed; gn[1].fl=0; while(cnt<m1){ for(int i=2;i<=m1;i++){ if(gn[i].fl==0) continue; else if(gn[i].st<=pre) continue; else{ gn[i].fl=0; pre=gn[i].ed; f1[cs]++; cnt++; } } cs++; f1[cs]=f1[cs-1]; pre=0; } for(int i=cs;i<=n;i++){ f1[i]=f1[i-1]; } cs=1,cnt=1; f2[1]=1; pre=gj[1].ed; gj[1].fl=0; while(cnt<m2){ for(int i=2;i<=m2;i++){ if(gj[i].fl==0) continue; else if(gj[i].st<=pre) continue; else{ gj[i].fl=0; pre=gj[i].ed; f2[cs]++; cnt++; } } cs++; f2[cs]=f2[cs-1]; pre=0; } for(int i=cs;i<=n;i++){ f2[i]=f2[i-1]; } for(int i=0;i<=n;i++){ ans=max(ans,f1[i]+f2[n-i]); } printf("%d\n",ans); fclose(stdin); fclose(stdout); return 0; }