This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, m;
cin >> n >> m;
vector<pair<int, int>> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i].second >> a[i].first;
}
sort(a.begin(), a.end());
vector<int> b(m);
for (int i = 0; i < m; i++) {
cin >> b[i];
}
sort(b.begin(), b.end());
int l = 0, r = min(n, m) + 1;
while (l + 1 < r) {
int mid = (l + r) / 2;
int it = m - mid;
for (int i = 0; i < n; i++) {
if (it < m && a[i].second <= b[it]) {
it++;
}
}
if (it == m) {
l = mid;
} else {
r = mid;
}
}
cout << l;
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... |