Submission #330363

#TimeUsernameProblemLanguageResultExecution timeMemory
330363fishy15Exhibition (JOI19_ho_t2)C++14
100 / 100
58 ms4588 KiB
#include <iostream> #include <iomanip> #include <fstream> #include <vector> #include <array> #include <algorithm> #include <utility> #include <map> #include <queue> #include <set> #include <cmath> #include <cstdio> #include <cstring> #define ll long long #define ld long double #define eps 1e-8 #define MOD 1000000007 #define INF 0x3f3f3f3f #define INFLL 0x3f3f3f3f3f3f3f3f // change if necessary #define MAXN 100010 using namespace std; int n, m; pair<int, int> paint[MAXN]; int frame[MAXN]; int main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> m; for (int i = 0; i < n; i++) { cin >> paint[i].first >> paint[i].second; } for (int i = 0; i < m; i++) { cin >> frame[i]; } sort(paint, paint + n, [](const pair<int, int> &p1, const pair<int, int> &p2) { if (p1.second == p2.second) return p1.first < p2.first; return p1.second < p2.second; }); sort(frame, frame + m); int cur_p = n - 1; int ans = 0; for (int i = m - 1; i >= 0; i--) { while (cur_p >= 0 && paint[cur_p].first > frame[i]) cur_p--; if (cur_p >= 0) { ans++; cur_p--; } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...