이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,a,b) for(int i = a; i < b; ++i)
signed main(){
int n, m;
cin >> n >> m;
pair<int,int> a[n];
REP(i,0,n) {
int s,v;
cin >> s >> v;
a[i] = {v,s};
}
sort(a,a+n,greater<pair<int,int>>());
int frame[m];
REP(i,0,m) {
cin >> frame[i];
}
sort(frame,frame+m,greater<int>());
int lo = 0, hi = n + 1;
while(lo < hi - 1){
int mi = (lo+hi)/2; ///mi is our guess
int i = 0, j = 0;
while (i < mi and j < n and i < m) {
if (a[j].second <= frame[i]) {
++i;
++j;
}
else {
++j;
}
}
if (i == mi) {
lo = mi;
}
else {
hi = mi;
}
}
cout << lo;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |