Submission #377892

#TimeUsernameProblemLanguageResultExecution timeMemory
377892smjleoExhibition (JOI19_ho_t2)C++14
100 / 100
77 ms8016 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") using namespace std; #define int long long #define nl '\n' #define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) mt19937 rng((unsigned)chrono::steady_clock::now().time_since_epoch().count()); const int mod = 1000000007, mod2 = 998244353; // change this const int N = 100005; int n, m, frame[N], ans; pair<int, int> pic[N]; signed main() { io; cin >> n >> m; for (int i=0; i<n; i++) cin >> pic[i].first >> pic[i].second; for (int i=0; i<m; i++) cin >> frame[i]; sort(frame, frame+m, greater<>()); priority_queue< pair<int, int> > pics; for (int i=0; i<n; i++) pics.push({pic[i].second, pic[i].first}); // value, size for (int i=0; i<m; i++) { // try this frame while (!pics.empty() && pics.top().second > frame[i]) pics.pop(); // too big if (pics.empty()) break; pics.pop(); // can add this ans++; } cout << ans << nl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...