Submission #680852

#TimeUsernameProblemLanguageResultExecution timeMemory
680852tvladm2009Exhibition (JOI19_ho_t2)C++14
100 / 100
46 ms4432 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { #ifdef ONPC freopen("input.txt", "r", stdin); #endif // ONPC #ifndef ONPC ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #endif // ONPC int n, m; cin >> n >> m; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } vector<int> frame(m); for (int i = 0; i < m; i++) { cin >> frame[i]; } auto cmp = [&](pair<int, int> i, pair<int, int> j) { return make_pair(i.second, i.first) < make_pair(j.second, j.first); }; sort(a.begin(), a.end(), cmp); sort(frame.begin(), frame.end()); int ret = 0; for (int i = n - 1, j = m - 1; i >= 0 && j >= 0; i--) { if (frame[j] >= a[i].first) { ret++; j--; } } cout << ret; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...