Submission #795740

#TimeUsernameProblemLanguageResultExecution timeMemory
795740makanhuliaRadio (COCI22_radio)C++17
0 / 110
37 ms10188 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; set<pair<int, int>, greater<pair<int, int>>> a; set<pair<int, int>> b; vector<bool> dead(n); deque<int> c(m); for(int i=0; i<n; i++) { int in; cin >> in; a.insert({in, i}); } for(int i=0; i<n; i++) { int in; cin >> in; b.insert({in, i}); } for(int &p : c) cin >> p; sort(c.begin(), c.end()); int ans=0; for(auto [p, i] : a) { if(c.empty()) break; if(p>c.back()) continue; dead[i]=1; ans++; c.pop_back(); } for(auto [p, i] : b) { if(c.empty()) break; if(dead[i]) continue; if(p<c.front()) continue; ans++; c.pop_front(); } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...