Submission #797848

#TimeUsernameProblemLanguageResultExecution timeMemory
797848khoquennguoiminhthuongExhibition (JOI19_ho_t2)C++17
100 / 100
112 ms4480 KiB
#include <bits/stdc++.h> using namespace std; int n,m; int c[100005]; pair<int,int>p[100005]; bool check(int x) { int dd=m-x+1; for(int i=1; i<=n; i++) if(p[i].second<=c[dd]) { dd++; if(dd==m+1)return 1; } return 0; } int main() { cin>>n>>m; for(int i=1; i<=n; i++)cin>>p[i].second>>p[i].first; for(int i=1; i<=m; i++)cin>>c[i]; sort(p+1,p+n+1); sort(c+1,c+m+1); int l=1,r=min(m,n),mid,kq=0; while(l<=r) { mid=(l+r)/2; if(check(mid)==1) { l=mid+1; kq=mid; } else r=mid-1; } cout<<kq; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...