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;
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 1e5 + 5;
int N, M, C[MAXN], ans;
pii A[MAXN];
priority_queue<pii> pq;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> N >> M;
for(int i=1; i<=N; i++) {
int s, v; cin >> s >> v;
pq.push(pii(v, s));
}
for(int i=1; i<=M; i++) cin >> C[i];
sort(C+1, C+1+M);
for(int i=M; i>=1; i--) {
while(!pq.empty() && pq.top().se > C[i]) pq.pop();
if(pq.empty()) break;
pq.pop();
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... |