Submission #1097966

#TimeUsernameProblemLanguageResultExecution timeMemory
1097966VMaksimoski008Inspections (NOI23_inspections)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #define ar array #define int long long using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int mod = 1e9 + 7; const int LOG = 20; const int maxn = 1e5 + 5; vector<pll> qus; int bin_search(ll p) { int l=0, r=qus.size()-1, ans=-1; while(l <= r) { int mid = (l + r) / 2; if(qus[mid].first <= p) ans = mid, l = mid + 1; else r = mid - 1; } return ans; } signed main() { ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); int n, m, q; cin >> n >> m >> q; ll day = 1; vector<int> L(m), R(m); for(int i=0; i<m; i++) cin >> L[i] >> R[i]; for(int i=0; i<q; i++) { ll x; cin >> x; qus.push_back({ x, i }); } sort(qus.begin(), qus.end()); vector<ll> ans(q), last(n+1); for(int i=0; i<m; i++) { for(int j=L[i]; j<=R[i]; j++) { if(last[j]) { int p = bin_search(day - last[j] - 1); if(p > -1) ans[p]++; } last[j] = day++; } } for(int i=q-2; i>=0; i--) ans[i] += ans[i+1]; sort(ans.rbegin(), ans.rend()); for(auto x : ans) cout << x << " "; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...