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(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin >> n >> m;
pair<int, int> pic[n];
int fram[m];
for(int i=0; i<n; i++){
cin >> pic[i].second >> pic[i].first;
}
sort(pic, pic+n);
for(int i=0; i<m; i++){
cin >> fram[i];
}
sort(fram, fram+m);
stack<pair<int, int> > pics;
stack<int> frames;
for(int i=0; i<n; i++){
pics.push(pic[i]);
}
for(int i=0; i<m; i++){
frames.push(fram[i]);
}
int picscnt = 0;
while(!pics.empty() && !frames.empty()){
if(pics.top().second<=frames.top()){
picscnt++;
pics.pop();
frames.pop();
}
else{
pics.pop();
}
}
cout << picscnt << '\n';
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... |