Submission #538432

#TimeUsernameProblemLanguageResultExecution timeMemory
538432new_accExhibition (JOI19_ho_t2)C++14
100 / 100
170 ms1544 KiB
#include<bits/stdc++.h> #define fi first #define se second #define pitem item* using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; const int N=1e6+10; pair<int,int> t[N]; int t2[N]; int n,m; int bs(int x){ int pocz=1,kon=m,sr,res=-1; while(pocz<=kon){ sr=(pocz+kon)>>1; if(t2[sr]>=x) res=sr,kon=sr-1; else pocz=sr+1; } return res; } void solve(){ cin>>n>>m; for(int i=1;i<=n;i++) cin>>t[i].se>>t[i].fi; sort(t+1,t+1+n); for(int i=1;i<=m;i++) cin>>t2[i]; sort(t2+1,t2+1+m); int maxi=0; for(int i=n;i>=1;i--){ int g=bs(t[i].se); if(g==-1) continue; g=m-g+1; g=min(g,maxi+1); maxi=max(maxi,g); } cout<<maxi<<"\n"; } int main(){ solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...