#include<bits/stdc++.h>
using namespace std;
const int N = 2e5;
int picval[N],picsz[N],p[N],framesz[N];
int main(){
int n,m;
cin>>n>>m;
for(int i = 0;i < n;i++){
cin>>picsz[i]>>picval[i];
p[i] = i;
}
for(int i = 0;i < m;i++){
cin>>framesz[i];
}
sort(framesz,framesz + m);
sort(p,p + n,[&](int a,int b){
return picval[a] < picval[b];
});
int pt = m - 1;
for(int i = n - 1;i >= 0;i--){
int id = p[i];
if(pt != -1 && picsz[id] <= framesz[pt]){
pt--;
}
}
cout<<m - 1 - pt;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
444 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
444 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
444 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |