Submission #140799

#TimeUsernameProblemLanguageResultExecution timeMemory
140799meatrowExhibition (JOI19_ho_t2)C++17
100 / 100
73 ms2480 KiB
//#pragma GCC optimize("O3") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native") //#pragma GCC optimize ("unroll-loops") #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, m; cin >> n >> m; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) { cin >> a[i].second >> a[i].first; } sort(a.begin(), a.end()); vector<int> b(m); for (int i = 0; i < m; i++) { cin >> b[i]; } sort(b.begin(), b.end()); int l = 0, r = min(n, m) + 1; while (l + 1 < r) { int mid = (l + r) / 2; int it = m - mid; for (int i = 0; i < n; i++) { if (it < m && a[i].second <= b[it]) { it++; } } if (it == m) { l = mid; } else { r = mid; } } cout << l; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...