제출 #530411

#제출 시각아이디문제언어결과실행 시간메모리
530411leu_nautExhibition (JOI19_ho_t2)C++14
50 / 100
1036 ms4452 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define f first #define s second #define ii pair <int,int> #define pii pair <ll,ll> const int N = 1e5; const int MOD = 1e9 + 7; const ll oo = 1e18; ii a[N + 5]; int c[N + 5],n,m; bool ok(int x) { priority_queue <int, vector <int>, greater <int>> pq; int j = 1, tmp = 0; for (int i = x; i <= m; ++i) { while (j <= n && c[i] >= a[j].f) { if (a[j].s >= tmp) pq.push(a[j].s); ++j; } if (pq.empty()) return false; tmp = pq.top(); pq.pop(); } return true; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m; for (int i = 1; i <= n; ++i) { cin >> a[i].f >> a[i].s; } for (int i = 1; i <= m; ++i) cin >> c[i]; sort(a + 1, a + 1 + n); sort(c + 1, c + 1 + m); for (int i = 1; i <= m; ++i) { if (ok(i)) { cout << m - i + 1 << '\n'; return 0; } } cout << 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...