// g++ -Wall -Wextra -std=c++17 -o B B.cpp
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define fs first
#define sc second
#define MP make_pair
int n, m, b[101000];
pii a[101000];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> a[i].sc >> a[i].fs;
for (int i = 1; i <= m; i++)
cin >> b[i];
sort(b + 1, b + 1 + m);
reverse(b + 1, b + 1 + m);
sort(a + 1, a + 1 + n);
reverse(a + 1, a + 1 + n);
int ans = 0, j = 1;
for (int i = 1; i <= m; i++) {
while (j <= n) {
if (a[j].sc <= b[i]) {
j++;
ans++;
break;
}
j++;
}
}
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |