Submission #99550

#TimeUsernameProblemLanguageResultExecution timeMemory
99550Dat160601Exhibition (JOI19_ho_t2)C++17
100 / 100
87 ms1656 KiB
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define fi first #define se second const int N = 100007; int n, m, c[N]; pair <int, int> pic[N]; bool check(int x){ int cur = m - x + 1; for(int i = 1; i <= n; i++){ if(cur > m) break; if(pic[i].se <= c[cur]) cur++; } return (cur > m); } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m; for(int i = 1; i <= n; i++){ cin >> pic[i].se >> pic[i].fi; } for(int i = 1; i <= m; i++){ cin >> c[i]; } sort(pic + 1, pic + 1 + n); sort(c + 1, c + 1 + m); int l = 0, r = min(n, m), mid = (l + r + 1) >> 1; while(l < r){ if(check(mid)) l = mid; else r = mid - 1; mid = (l + r + 1) >> 1; } cout << l; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...