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<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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |