#include <bits/stdc++.h>
using namespace std;
int n, m, f[100010], p1, p2, ans;
pair<int, int> art[100010];
int main() {
cin >> n >> m;
for(int i=1; i<=n; i++) {
cin >> art[i].second >> art[i].first;
}
for(int i=1; i<=m; i++) {
cin >> f[i];
}
sort(art+1, art+n+1);
sort(f+1, f+m+1);
p1 = n;
p2 = m;
while(p1 >= 1 && p2 >= 1) {
if(art[p1].second <= f[p2]) {
ans++;
p1--;
p2--;
} else {
p1--;
}
}
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... |