Submission #97761

#TimeUsernameProblemLanguageResultExecution timeMemory
97761Bodo171Exhibition (JOI19_ho_t2)C++14
100 / 100
89 ms1664 KiB
#include <iostream> #include <fstream> #include <algorithm> using namespace std; const int nmax=100005; pair<int,int> v[nmax]; int a[nmax]; int n,m,i; bool check(int poz) { poz=m-poz+1; for(i=1;i<=n;i++) if(poz<=m&&v[i].second<=a[poz]) poz++; return (poz>m); } int main() { //freopen("data.in","r",stdin); ios_base::sync_with_stdio(false); cin>>n>>m; for(i=1;i<=n;i++) { cin>>v[i].second>>v[i].first; } sort(v+1,v+n+1); for(i=1;i<=m;i++) { cin>>a[i]; } sort(a+1,a+m+1); int ans=0; for(int p=17;p>=0;p--) if(ans+(1<<p)<=m&&check(ans+(1<<p))) ans+=(1<<p); cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...