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;
using ll = long long;
pair<int, int> a[100100];
int b[100100];
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m;
cin >> n >> m;
for (int i = 1;i <= n;i++) cin >> a[i].second >> a[i].first;
for (int i = 1;i <= m;i++) cin >> b[i];
sort(a + 1, a + 1 + n, greater<pair<int, int>>());
sort(b + 1, b + 1 + m, greater<int>());
int ans = 0;
for (int i = 1;i <= n;i++) {
int idx = upper_bound(b + 1, b + 1 + m, a[i].second, greater<int>()) - b - 1;
if (ans + 1 <= idx) ans++;
}
cout << ans;
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... |