#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define int long long
using namespace std;
signed main(){
vector <int> v1;
vector <pair <int, int> > v;
int n, m;
cin>>n>>m;
for(int i=1; i<=n; i++){
int a, b;
cin>>a>>b;
v.pb({b, a});
}
for(int i=1; i<=m; i++){
int a;
cin>>a;
v1.pb(a);
}
sort(v1.begin(), v1.end());
sort(v.begin(), v.end());
int ans=0, j=m-1;
for(int i=n-1; i>=0; i--){
if(v[i].ss<v1[j]){
ans++;
j--;
}
if(j==-1){
break;
}
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |