이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |