Submission #367322

#TimeUsernameProblemLanguageResultExecution timeMemory
367322piddddgyExhibition (JOI19_ho_t2)C++11
0 / 100
1 ms364 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; // #define cerr if(false) cerr #define watch(x) cerr << (#x) << " is " << (x) << endl; #define endl '\n' #define ld long double #define int long long #define pii pair<int, int> #define fi first #define se second #define sz(a) (int)(a).size() #define all(x) (x).begin(), (x).end() const int maxn = 100500; int n, m; pii a[maxn]; signed main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> m; for(int i = 1; i <= n; i++) { cin >> a[i].fi >> a[i].se; } priority_queue<int> pq; for(int i = 1; i <= m; i++) { int x; cin >> x; pq.push(-x); } sort(a+1, a+n+1); int lst = -1e18; int ans = 0; for(int i = 1; i <= n; i++) { if(a[i].se >= lst) { while(sz(pq) and -pq.top() < a[i].fi) pq.pop(); if(sz(pq)) { pq.pop(); ans++; lst = a[i].se; } } } cout << ans << endl; } /* sort by value then by size Did you read the bounds? Did you make typos? Are there edge cases (N=1?) Are array sizes proper? Integer overflow? DS reset properly between test cases? Is using long longs causing TLE? Are you using floating points? */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...