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;
const int N = 100000;
array<int, 2> pics[N];
int frames[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
for (int i = 0; i < n; ++i) {
auto &[v, s] = pics[i];
cin >> s >> v;
}
sort(pics, pics + n);
for (int i = 0; i < m; ++i) {
cin >> frames[i];
}
sort(frames, frames + m);
int low = 0, high = m;
while (low < high) {
int mid = (low + high + 1) / 2;
int j = 0;
for (int i = 0; i < n && j < mid; ++i) {
auto [v, s] = pics[i];
j += s <= frames[m - mid + j];
}
if (j == mid) {
low = mid;
} else {
high = mid - 1;
}
}
cout << high << "\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... |