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;
int n,m;
int c[100005];
pair<int,int>p[100005];
bool check(int x) {
int dd=m-x+1;
for(int i=1; i<=n; i++)
if(p[i].second<=c[dd]) {
dd++;
if(dd==m+1)return 1;
}
return 0;
}
int main() {
cin>>n>>m;
for(int i=1; i<=n; i++)cin>>p[i].second>>p[i].first;
for(int i=1; i<=m; i++)cin>>c[i];
sort(p+1,p+n+1);
sort(c+1,c+m+1);
int l=1,r=min(m,n),mid,kq=0;
while(l<=r) {
mid=(l+r)/2;
if(check(mid)==1) {
l=mid+1;
kq=mid;
} else r=mid-1;
}
cout<<kq;
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... |