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 int long long
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
signed main(){
int n,m;
cin>>n>>m;
vector < pair <int,int> > v;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
v.pb({y,x});
}
sort(all(v));
vector <int> c(m);
for(int i=0;i<m;i++){
cin>>c[i];
}
sort(all(c));
vector <int >pos;
for(int i=0;i<n;i++){
auto x=lower_bound(all(c),v[i].ss)-c.begin();
pos.pb(x);
}
int p=-1,cnt=0;
for(auto i : pos){
if(p==m-1)break;
if(i>=m)continue;
p=max(p+1,i);
cnt++;
}
cout<<cnt<<"\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... |