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;
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define fs first
#define sc second
#define pb push_back
void solve(){
int n,m;
cin>>n>>m;
pii a[n];
for(int i=0;i<n;i++)cin>>a[i].sc>>a[i].fs;
int c[m];
for(int i=0;i<m;i++)cin>>c[i];
sort(a,a+n);
sort(c,c+m);
int l=0,r=m;
while(l<r){
int md=(l+r+1)/2;
int idx=m-md;
for(auto[z,x]:a){
if(idx==m)break;
if(c[idx]>=x)idx++;
}
if(idx==m)l=md;
else r=md-1;
}
cout<<l;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |