# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
736653 | 2023-05-06T04:35:32 Z | JellyTheOctopus | Exhibition (JOI19_ho_t2) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #define f first #define s second int N, M; vector<pair<int, int>> pictures; vector<int> frames; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> N >> M; pictures.resize(N); frames.resize(M); for (int i = 0; i < N; i++) { cin >> pictures[i].s >> pictures[i].f; } for (int i = 0; i < M; i++) { cin >> frames[i]; } sort(pictures.begin(), pictures.end()); sort(frames.begin(), frames.end()); int finalAns = 0; for (int i = 0; i < N; i++) { if ((i == N-1) || (pictures[i].s > pictures[i+1].s)) { int j = i; int k = M-1; int localAns = 0; while ((j >= 0) && (k >= 0)) { bool flag = false; while (pictures[j].s > frames[k]) { j--; if (j < 0) { flag = true; break; } } if (flag) break; localAns++; j--; k--; } finalAns = max(localAns, finalAns); } } cout << finalAns << "\n";