이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define int long long
bool debug = false;
int mod = 1e9+7;
signed main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
int n, m; cin >> n >> m;
vector<pair<int, int>> pics(n);
vector<int> frames(m);
for (int i = 0; i < n; ++i){
cin >> pics[i].second >> pics[i].first;
}
for (int i = 0; i < m; ++i){
cin >> frames[i];
}
sort(frames.begin(), frames.end());
sort(pics.begin(), pics.end());
int lo = 0, hi = min(n, m)+1, mid = (lo + hi)/2, count, temp;
bool found = false;
while (lo < hi - 1){
if(debug)cout << mid << '\n';
count = 0;
temp = 0;
found = false;
for (int i = 0; i < n; ++i){
if (pics[i].first >= temp && pics[i].second <= frames[m-mid+count]){
temp = pics[i].first;
count++;
}
if (count == mid){
found = true;
lo = mid;
mid = (lo + hi)/2;
break;
}
}
if (!found){
hi = mid;
mid = (lo + hi)/2;
}
}
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... |