Submission #392277

#TimeUsernameProblemLanguageResultExecution timeMemory
392277wildturtleExhibition (JOI19_ho_t2)C++14
100 / 100
154 ms5620 KiB
#include<bits/stdc++.h> #define ll long long #define f first #define sc second using namespace std; ll a,b,c,d,i,e,f,g,n,m,k,l,idx,B[500005],le,ri,mid,ans; pair <ll , ll> A[500005]; bool go(ll x) { //cout<<x<<" "; idx=m-x+1; for(ll i=1;i<=n;i++) { if(A[i].sc<=B[idx]) idx++; if(idx==m+1) return 1; } return 0; } int main() { cin>>n>>m; for(ll i=1;i<=n;i++) { cin>>A[i].sc>>A[i].f; } for(ll i=1;i<=m;i++) { cin>>B[i]; } sort(A+1,A+1+n); sort(B+1,B+1+m); le=1; ri=min(n,m); while(le<=ri) { mid=(le+ri)/2; if(go(mid)==1) { le=mid+1; ans=mid; } else ri=mid-1; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...