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>
int main() {
std::ios::sync_with_stdio(0); std::cin.tie(0);
int n, m, ans = 0; std::cin >> n >> m;
std::vector <std::pair <int, int>> b(n); for (auto& p : b) std::cin >> p.second >> p.first; std::sort(b.begin(), b.end());
std::vector <int> a(m); for (int& x : a) std::cin >> x; std::sort(a.begin(), a.end());
for (int i = m - 1, cnt = n - 1; i >= 0; i--) {
while (cnt >= 0 && b[cnt].second > a[i]) cnt--;
ans += cnt >= 0, cnt -= cnt >= 0;
}
std::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... |