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;
typedef long long ll;
typedef pair<int,int> pii;
int n,m;
pii A[100005];
int B[100005];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n>>m;
for(int i=0;i<n;i++) cin>>A[i].second>>A[i].first;
for(int i=0;i<m;i++) cin>>B[i];
sort(B,B+m);
sort(A,A+n);
int s = 0, e = m;
int ans = 0;
while(s<=e) {
int mid = (s+e)/2;
int p = m - mid;
for(int i=0;i<n;i++) {
if(p < m && A[i].second <= B[p]) p++;
}
if(p == m) {
ans = max(ans, mid);
s = mid + 1;
} else e = mid - 1;
}
cout<<ans;
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... |