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;
/* sorry, this is the bare minimum :'( */
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second
int main(int argc, char const *argv[])
{
cin.sync_with_stdio(0); cin.tie(0);
cin.exceptions(cin.failbit);
#ifdef LOCAL
freopen("in", "r", stdin);
#endif
int n, m;
cin >> n >> m;
priority_queue<ii> Q;
for(int i = 0; i < n; ++i) {
int s, v;
cin >> s >> v;
Q.emplace(v, s);
}
vi frame(m);
for(int& x : frame) {
cin >> x;
}
sort(all(frame));
int ans = 0;
while(sz(frame)) {
int fs = frame.back();
frame.pop_back();
while(sz(Q) and Q.top().second > fs) {
Q.pop();
}
if(sz(Q)) {
ans++;
Q.pop();
}
}
cout << ans << endl;
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... |