Submission #538110

#TimeUsernameProblemLanguageResultExecution timeMemory
538110thegrimbeeExhibition (JOI19_ho_t2)C++14
100 / 100
68 ms5600 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...