Submission #766579

#TimeUsernameProblemLanguageResultExecution timeMemory
766579tigarExhibition (JOI19_ho_t2)C++14
100 / 100
125 ms6348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; //first->value //second->size int n, m; ll c[100010], arr[100010]; pair<ll, ll>pics[100010]; int main() { cin>>n>>m; for(int i=1; i<=n; i++)cin>>pics[i].second>>pics[i].first; for(int i=1; i<=m; i++)cin>>c[i]; sort(pics+1, pics+n+1); sort(c+1, c+m+1); for(int i=1; i<=n; i++) { int l=1, r=m+1, mid=(m+2)/2; while(l<=r) { if(c[mid]<pics[i].second){l=mid+1; mid=(l+r)/2;} else {r=mid-1; mid=(l+r)/2;} } arr[i]=l; } int br=0, ans=0; for(int i=n; i>0; i--) { if(m-arr[i]>=br){ans++; br++;} } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...