Submission #391333

#TimeUsernameProblemLanguageResultExecution timeMemory
391333timmyfengExhibition (JOI19_ho_t2)C++17
0 / 100
1 ms332 KiB
#include <bits/stdc++.h> using namespace std; const int N = 100000; array<int, 2> pics[N]; int frames[N], lis[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) { auto &[s, v] = pics[i]; cin >> s >> v; } sort(pics, pics + n); for (int i = 0; i < m; ++i) { cin >> frames[i]; } sort(frames, frames + m); int low = 0, high = m; while (low < high) { int mid = (low + high + 1) / 2; fill(lis, lis + mid, INT_MAX); for (int i = 0; i < n; ++i) { auto [s, v] = pics[i]; int j = upper_bound(lis, lis + mid, v) - lis; if (j < mid && s <= frames[m - mid + j]) { lis[j] = v; } } if (lis[mid - 1] < INT_MAX) { low = mid; } else { high = mid - 1; } } cout << high << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...