제출 #522260

#제출 시각아이디문제언어결과실행 시간메모리
522260OttoTheDinoThe short shank; Redemption (BOI21_prison)C++17
0 / 100
263 ms28476 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i,s,e) for (int i = s; i <= e; ++i) #define rrep(i,s,e) for (int i = s; i >= e; --i) #define pb push_back #define pf push_front #define fi first #define se second #define all(a) a.begin(), a.end() typedef long long ll; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<int> vi; typedef vector<double> vd; typedef vector<string> vs; typedef vector<ll> vll; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, D, T; cin >> n >> D >> T; int t[n+2]; rep (i,1,n) cin >> t[i]; int cnt[n+1] = {}, cnt2[n+1] = {}, ans = 0; set<ii> st; set<int> st2; rep (i,1,n) { if (t[i]>T) { while (!st.empty() && (*st.begin()).fi < i) { int j = (*st.begin()).se; st.erase(st.begin()); st2.erase(j); } if (st.empty()) ++ans; else { cnt[(*st.begin()).se]++; cnt2[i]++; } } else { st.insert({i+T-t[i],i}); st2.insert(i); } } int cur = 0, ans2 = 0; rep (i,1,n) { cur += cnt[i] - cnt2[i]; ans2 = max (ans2, cur); } cout << n-ans-ans2 << "\n"; 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...
#Verdict Execution timeMemoryGrader output
Fetching results...