Submission #551991

#TimeUsernameProblemLanguageResultExecution timeMemory
551991GurbanExhibition (JOI19_ho_t2)C++17
100 / 100
47 ms1632 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...