This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |