Submission #364743

#TimeUsernameProblemLanguageResultExecution timeMemory
364743Mamnoon_SiamExhibition (JOI19_ho_t2)C++17
100 / 100
63 ms1768 KiB
#include <bits/stdc++.h> using namespace std; /* sorry, this is the bare minimum :'( */ using ll = long long; using ii = pair<int, int>; using vi = vector<int>; #define all(v) begin(v), end(v) #define sz(v) (int)(v).size() #define fi first #define se second int main(int argc, char const *argv[]) { cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit); #ifdef LOCAL freopen("in", "r", stdin); #endif int n, m; cin >> n >> m; priority_queue<ii> Q; for(int i = 0; i < n; ++i) { int s, v; cin >> s >> v; Q.emplace(v, s); } vi frame(m); for(int& x : frame) { cin >> x; } sort(all(frame)); int ans = 0; while(sz(frame)) { int fs = frame.back(); frame.pop_back(); while(sz(Q) and Q.top().second > fs) { Q.pop(); } if(sz(Q)) { ans++; Q.pop(); } } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...