이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define sz(x) (int) (x).size()
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m; cin >> n >> m;
pair<int, int> p[100005];
for(int i=0; i<n; i++){
int a, b; cin >> a >> b;
p[i]= make_pair(b, a);
}
int f[100005];
for(int i=0; i<m; i++){cin >> f[i];}
sort(p, p+n); reverse(p, p+n);
sort(f, f+m); reverse(f, f+m);
int l= 0;
int ans= 0;
for(int i=0; i<m; i++){
//cout << "f[i] " << f[i] << endl;
while(p[l].second>f[i]){
//cout << l << " " << p[l].second << endl;
l++;
if(l==n){break;}
}
if(l==n){break;}
l++;
ans++;
if(l==n){break;}
}
cout << ans << endl;
}
/*
8 8
508917604 35617051 501958939 840246141 485338402 32896484 957730250 357542366 904165504 137209882 684085683 775621730 552953629 20004459 125090903 607302990 433255278
979756183
28423637
856448848
276518245
314201319
666094038
149542543
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |