Submission #332732

#TimeUsernameProblemLanguageResultExecution timeMemory
332732limabeansExhibition (JOI19_ho_t2)C++17
100 / 100
57 ms4608 KiB
#include <bits/stdc++.h> using namespace std; template<typename T> void out(T x) { cout << x << endl; exit(0); } #define watch(x) cout << (#x) << " is " << (x) << endl using ll = long long; const int inf = 2e9; void print(vector<int> a, int n) { for (int i=0; i<n; i++) { cout<<a[i]<<" "; } cout<<endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin>>n>>m; vector<pair<int,int>> a(n); // (val, size) for (int i=0; i<n; i++) { cin>>a[i].second>>a[i].first; } sort(a.begin(), a.end()); vector<int> w(m); for (int i=0; i<m; i++) { cin>>w[i]; } sort(w.begin(),w.end()); int ans = 0; int ptr = n-1; for (int i=m-1; i>=0 && ptr>=0; i--) { while (ptr>=0 && a[ptr].second > w[i]) ptr--; if (ptr>=0) { --ptr; ans++; } } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...