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>
#define ff first
#define ss second
using namespace std;
int n,m,c[100005],i,j,ans;
pair<int,int> p[100005];
bool cmp(pair<int,int> a,pair<int,int> b){
if(a.ss==b.ss) return a.ff<b.ff;
return a.ss<b.ss;
}
int main(){
cin >> n >> m;
for(i=1;i<=n;i++){
cin >> p[i].ff >> p[i].ss;
}
for(i=1;i<=m;i++){
cin >> c[i];
}
sort(p+1,p+n+1,cmp);
sort(c+1,c+m+1);
j=n;
for(i=m;i>=1;i--){
while(c[i]<p[j].ff) j--;
if(j>0) ans++;
else break;
j--;
}
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... |