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;
using ll = long long;
const int maxn=2e5+5;
int n,m;
// int T[maxn << 2];
// void upd(int idx,int val,int l,int r,int nd){
// if(l == r){
// T[nd] = val;
// return;
// }
// int md = (l + r) >> 1;
// if(idx <= md) upd(idx,val,l,md,nd<<1);
// else upd(idx,val,md+1,r,nd<<1 | 1);
// T[nd] = max(T[nd<<1],T[nd<<1 | 1]);
// }
// int tap(int a,int b,int l,int r,int nd){
// if(r < a or l > b) return 0;
// if(l >= a and r <= b) return T[nd];
// int md = (l + r) >> 1;
// return max(tap(a,b,l,md,nd<<1),tap(a,b,md+1,r,nd<<1 | 1));
// }
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
vector<pair<int,int>>a;
for(int i = 0;i < n;i++){
int s,v; cin >> s >> v;
a.push_back({v,s});
}
vector<int>c(m);
for(int i = 0;i < m;i++) cin >> c[i];
sort(c.begin(),c.end());
sort(a.begin(),a.end());
int now = (int)c.size()-1;
for(int i = (int)a.size()-1;i >= 0;i--){
if(now < 0) break;
if(a[i].second <= c[now]) now--;
}
cout<<(int)c.size()-now-1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |