Submission #919544

#TimeUsernameProblemLanguageResultExecution timeMemory
919544iskhakkutbilimExhibition (JOI19_ho_t2)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define all(a) a.begin(), a.end() const int mod = 1e9 + 7; const int N = 1e5; #define int long long struct node{ int mn; }; node UND = {mod}; struct Segtree{ int n; vector<node> t; Segtree(int sz){ n = sz; t.resize(n * 4, UND); }; node merge(node A, node B){ if(A.mn < B.mn) return A; return B; } void update(int pos, int x, int v, int vl, int vr){ if(vl == vr){ t[v].mn = min(t[v].mn, x); return; } int mid = (vl + vr)>>1; if(mid >= pos) update(pos, x, v<<1, vl, mid); else update(pos, x, v<<1|1, mid+1, vr); t[v] = merge(t[v<<1], t[v<<1|1]); } node get(int l, int r, int v, int vl, int vr){ if(l > vr or vl > r) return UND; if(l <= vl and r >= vr) return t[v]; int mid = (vl + vr)>>1; return merge(get(l, r, v<<1, vl, mid), get(l, r, v<<1|1, mid+1, vr)); } }; signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; vector< array<int, 2> > a(n); for(int i = 0;i < n; i++){ cin >> a[i][0] >> a[i][1]; } sort(all(a), [&](auto A, auto B){ return A[1] < B[1]; }); vector<int> frame(m); for(auto &e : frame) cin >> e; sort(all(frame)); reverse(all(frame)); int ans = 0; for(int i = 0;i < m; i++){ while(a.size() && a.back()[0] > frame[i]) a.pop_back(); if(!a.size()) break; ans++; a.pop_back(); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...