Submission #699066

#TimeUsernameProblemLanguageResultExecution timeMemory
699066RichemExhibition (JOI19_ho_t2)C++14
100 / 100
185 ms7240 KiB
#include <iostream> #include <queue> #include <algorithm> #define int long long using namespace std; const int MAX_TABLEAU = 1e5+42; int nbTableau, nbCadre; pair<int, int> tableau[MAX_TABLEAU]; int cadre[MAX_TABLEAU]; priority_queue<pair<int, int>> q; void input() { cin >> nbTableau >> nbCadre; for(int i = 0; i < nbTableau; i++) { cin >> tableau[i].first >> tableau[i].second; q.push({tableau[i].second, tableau[i].first}); } sort(tableau, tableau + nbTableau); for(int i = 0; i < nbCadre; i++) { cin >> cadre[i]; } sort(cadre, cadre + nbCadre); } int total = 0; signed main() { input(); for(int curCadre = nbCadre-1; curCadre >= 0; curCadre--) { while(q.size() > 0 && q.top().second > cadre[curCadre]) { q.pop(); } if(q.size() == 0) { break; } total++; q.pop(); } cout << total; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...