This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//I wrote this code 4 u <3
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
signed main(int32_t argc, char *argv[]) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<pair<int, int>> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i].first >> a[i].second;
}
vector<int> b(m);
for (int i = 0; i < m; ++i) {
cin >> b[i];
}
sort(a.begin(), a.end(), [&](const pair<int, int> &fir, const pair<int, int> &sec) {
return fir.second > sec.second || (fir.second == sec.second && fir.first > sec.first);
});
sort(b.rbegin(), b.rend());
int ans = 0;
for (int i = 0; i < n; ++i) {
if (b[ans] >= a[i].first) {
ans++;
}
}
cout << ans;
}
/*
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |