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 ll long long
#define ii pair<long long, long long>
using namespace std;
const int MAXN = 1e5 + 5;
ll n,m,res;
ii p[MAXN];
ll c[MAXN];
bool cmp(ii a, ii b){
if(a.first > b.first) return true;
else if(a.first == b.first) return a.second > b.second;
return false;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>m;
for(int i = 1;i<=n;i++){
cin>>p[i].second>>p[i].first;
}
for(int i = 1;i<=m;i++) cin>>c[i];
sort(p+1,p+n+1,cmp);
sort(c+1,c+m+1);
int j = 1;
for(int i = m;i>=1;i--){
while(j <= n && p[j].second > c[i]){
j++;
}
if(j == n+1){
break;
}
else{
res++;
j++;
}
}
cout<<res;
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... |