#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> jaaz;
vector<pair<int, int>> z;
int main()
{
int n, m;
cin >> n >> m;
for(int i = 0; i < n; i++){
int s, v;
cin >> s >> v;
z.push_back({v, s});
}
for(int i = 0; i < m; i++){
int j;
cin >> j;
jaaz.push_back(j);
}
sort(z.begin(), z.end());
sort(jaaz.begin(), jaaz.end());
int i = n - 1, j = m - 1;
int ans = 0;
while(i >= 0 && j >= 0){
if(z[i].second <= jaaz[j]){
i--;
j--;
ans++;
}else{
i--;
}
}
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... |