제출 #99555

#제출 시각아이디문제언어결과실행 시간메모리
99555DrumpfTheGodEmperorExhibition (JOI19_ho_t2)C++14
0 / 100
2 ms384 KiB
#include <bits/stdc++.h> #define bp __builtin_popcountll #define pb push_back #define in(s) freopen(s, "r", stdin); #define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\ freopen((string(s) + "." + end2).c_str(), "w", stdout); #define fi first #define se second #define bw(i, r, l) for (int i = r - 1; i >= l; i--) #define fw(i, l, r) for (int i = l; i < r; i++) #define fa(i, x) for (auto i: x) using namespace std; const int mod = 1e9 + 7, inf = 1061109567; const long long infll = 4557430888798830399; const int N = 1e5 + 5; int n, m, c[N]; struct Picture { int s, v; } p[N]; bool cmp1(const Picture &lhs, const Picture &rhs) { return lhs.s < rhs.s; } bool cmp2(const Picture &lhs, const Picture &rhs) { return lhs.v < rhs.v; } bool check(int x) { if (!x) return 1; int ptr = 0; bw (i, x, 0) { while (ptr < n && p[ptr].s > c[i]) ptr++; if (ptr == n) return 0; ptr++; } return 1; } signed main() { #ifdef BLU in("blu.inp"); #endif ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> m; fw (i, 0, n) cin >> p[i].s >> p[i].v; sort(p, p + n, cmp2); // reverse(p, p + n); fw (i, 0, m) cin >> c[i]; sort(c, c + m); reverse(c, c + m); int l = 0, r = min(n, m); while (l < r) { int m = (l + r) >> 1; if (check(m + 1)) l = m + 1; else r = m; } cout << l; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...