#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
multiset <pair <int, int>> q;
int frame[100005];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n, m;
cin >> n >> m;
for(int i=1; i<=n; i++){
int a, b;
cin >> a >> b;
q.insert({-b, a});
}
for(int i=1; i<=m; i++){
cin >> frame[i];
}
sort(frame+1, frame+1+m);
int res = 0;
for(int i=m; i>=1; i--){
while(!q.empty()){
pair <int, int> par = *q.begin();
q.erase(q.begin());
if(par.second > frame[i]) continue;
res++;
break;
}
}
cout << res;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |