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 N, M;
pair<int, int> arr[100005];
int brr[100005];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> M;
for(int i = 1; i<=N; i++){
cin >> arr[i].first >> arr[i].second;
}
for(int i = 1; i<=M; i++){
cin >> brr[i];
}
sort(arr+1, arr+1+N, [](pair<int, int> p, pair<int, int> q){
if(p.second == q.second){
return p.first < q.first;
}
return p.second < q.second;
});
sort(brr+1, brr+1+M);
int ptr = N;
int ans =0;
for(int i = M; i; i--){
while(ptr && arr[ptr].first > brr[i]){
ptr--;
}
if(ptr){
ptr--;
ans++;
}
}
cout << ans << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |