Submission #166040

#TimeUsernameProblemLanguageResultExecution timeMemory
166040sochoExhibition (JOI19_ho_t2)C++14
100 / 100
263 ms4736 KiB
#include "bits/stdc++.h" using namespace std; int main() { int n, m; cin >> n >> m; vector<pair<int, int> > pics; for (int i=0; i<n; i++) { int sz, vl; cin >> sz >> vl; pics.push_back(make_pair(vl, sz)); } sort(pics.begin(), pics.end()); int cap[m]; for (int i=0; i<m; i++) cin >> cap[i]; sort(cap, cap+m); int res = 0; int where = n - 1; for (int i=m-1; i>=0; i--) { for (; where >= 0 && pics[where].second > cap[i]; where--) {} if (where >= 0) { where--; res++; } } cout << res << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...