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;
int main() {
int n, m;
cin >> n >> m;
vector<pair<int, int> > pics;
for (int i=0; i<n; i++) {
int sz, vl;
cin >> sz >> vl;
pics.push_back(make_pair(vl, sz));
}
sort(pics.begin(), pics.end());
int cap[m];
for (int i=0; i<m; i++) cin >> cap[i];
sort(cap, cap+m);
int res = 0;
int where = n - 1;
for (int i=m-1; i>=0; i--) {
for (; where >= 0 && pics[where].second > cap[i]; where--) {}
if (where >= 0) {
where--;
res++;
}
}
cout << res << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |