이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |