This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define fr first
#define se second
int32_t main() {
//freopen("in", "r", stdin);
int n, m;
cin >> n >> m;
vector<pii> p(n);
vector<int> c(m);
for (int i = 0; i < n; i++) {
cin >> p[i].se >> p[i].fr;
}
for (int i = 0; i < m; i++) {
cin >> c[i];
}
sort(p.begin(), p.end());
sort(c.begin(), c.end());
int ans = 0;
for (int i = m - 1; i >= 0; i--) {
while (!p.empty() && (p.back().se > c[i])) p.pop_back();
if (p.empty()) break;
ans++;
p.pop_back();
}
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... |