#include "bits/stdc++.h"
using namespace std;
#define vec vector
#define int long long
#define all(x) (x).begin(), (x).end()
const int mod = 998244353;
const int inf = LLONG_MAX;
using pii = pair<int, int>;
signed main() {
int n, m;
cin >> n >> m;
vec<pii> pictures(n);
for (auto &[s, v] : pictures)
cin >> s >> v;
sort(pictures.begin(), pictures.end(), [](const pii &a, const pii &b) {
return a.second < b.second ||
(a.second == b.second && a.first < b.first);
});
vec<int> frames(m);
for (int &x : frames)
cin >> x;
sort(all(frames));
int i = 0, j = 0, ans = 0;
while (i < n && j < m) {
if (frames[j] >= pictures[i].first) {
ans++;
i++;
j++;
} else {
j++;
}
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |