#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin >> n >> m;
vector<pair<int,int>> a(n + 1);
for(int i = 1; i <= n; i++) {
cin >> a[i].second >> a[i].first;
}
vector<int> x(m + 1);
for(int i = 1; i <= m; i++) {
cin >> x[i];
}
sort(x.begin() + 1, x.end());
sort(a.begin() + 1, a.end());
int ans = 0;
int X = n, Y = m;
while(X > 0 && Y > 0) {
if(x[Y] >= a[X].second) {
Y -= 1;
ans += 1;
}
X -= 1;
}
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... |