This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |