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;
using ll=long long;
int main(){
int N, M;
cin >> N >> M;
vector<pair<int, int>> SV;
for(int i=0;i<N;i++){
int s, v;
cin >> s >> v;
SV.push_back({v, s});
}
vector<ll> C(M);
for(int i=0;i<M;i++){
cin >> C[i];
}
sort(SV.begin(), SV.end());
vector<ll> S(N);
for(int i=0;i<N;i++){
S[i]=SV[i].second;
}
sort(C.begin(), C.end());
int now=M-1;
int ans=0;
for(int i=N-1;i>-1;i--){
if(S[i]<=C[now]){
ans++;
now--;
}
if(now<0){
break;
}
}
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... |