Submission #996811

#TimeUsernameProblemLanguageResultExecution timeMemory
996811vicvicExhibition (JOI19_ho_t2)C++11
0 / 100
2 ms1624 KiB
#include <iostream> #include <fstream> #include <algorithm> #include <vector> using namespace std; vector <pair <int, int>> pictures (100005); vector <int> frames (100005); int n, m; bool compare (pair <int, int> a, pair <int, int> b) { if (a.second!=b.second) { return a.second<b.second; } return a.first<b.first; } int main() { cin >> n >> m; for (int i=1;i<=n;i++) { cin >> pictures[i-1].first >> pictures[i-1].second; } for (int i=1;i<=m;i++) { cin >> frames[i-1]; } sort (pictures.begin(), pictures.begin()+n, compare); sort (frames.begin(), frames.begin()+m); int i=0, j=0, ret=0; while (i<n && j<m) { if (pictures[i].first<=frames[j]) { i++; j++; ret++; } else { j++; } } cout << ret; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...