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;
#define ll long long int
#define pii pair<long long int,long long int>
#define vi vector<long long int >
#define vvi vector<vector< long long int>>
#define MP make_pair
#define PB push_back
#define pb pop_back
#define PF push_front
#define pf pop_front
#define MOD 1000000007
#define MT make_tuple
ll n,m;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>m;
pii a[n];
ll b[m];
for(ll i=0;i<n;i++)
{
cin>>a[i].second>>a[i].first;
}
for(ll i=0;i<m;i++)
cin>>b[i];
sort(a,a+n);
sort(b,b+m);
ll j=n-1;
ll ans=0;
for(ll i=m-1;i>=0 && j>=0;i--)
{
while(j>=0 && a[j].second>b[i])
j--;
if(j>=0)
{
ans++;
j--;
}
}
cout<<ans<<"\n";
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... |