Submission #894625

#TimeUsernameProblemLanguageResultExecution timeMemory
894625IWKRExhibition (JOI19_ho_t2)C++17
100 / 100
58 ms6740 KiB
#include <bits/stdc++.h> using namespace std; #define int long long vector<pair<int, int>> v; vector<int> frames; int n, m; bool isOkay(int k) { int start = 0; for (int i = k; i < m; i++) { while (start < n && v[start].second > frames[i]) { start++; } if (start == n) { return false; } else { start++; } } return true; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; v.push_back({b, a}); } for (int i = 0; i < m; i++) { int c; cin >> c; frames.push_back(c); } sort(v.begin(), v.end()); sort(frames.begin(), frames.end()); int low = -1; int high = m; while (high - low > 1) { int mid = (high + low) / 2; if (isOkay(mid)) { high = mid; } else { low = mid; } } cout << m - high; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...