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 main(){
int n, m;
cin >> n >> m;
vector<pair<int, int>> pictures(n);
for(int i = 0; i<n; i++){
cin >> pictures[i].first >> pictures[i].second;
swap(pictures[i].first, pictures[i].second);
}
sort(pictures.begin(), pictures.end(), greater<pair<int, int>>());
vector<int> vals(n);
for(int i = 0; i < n; i++) {
vals[i] = pictures[i].second;
}
vector<int> frames(m);
for(int i = 0; i<m; i++){
cin >> frames[i];
}
sort(frames.begin(), frames.end(), greater<int>());
int ans = 0, ptr = 0;
for(int i = 0; i<m; i++){
while(ptr<n && vals[ptr] > frames[i]){
ptr++;
}
ptr++;
if(ptr > n) break;
ans++;
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |