Submission #1045470

#TimeUsernameProblemLanguageResultExecution timeMemory
1045470pccThe short shank; Redemption (BOI21_prison)C++17
0 / 100
45 ms9524 KiB
#include <bits/stdc++.h> using namespace std; #define pii pair<int,int> #define fs first #define sc second const int mxn = 2e6+10; int N,D,T; vector<int> seq[3]; vector<pii> v; int arr[mxn]; int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>N>>D>>T; int ans = N; for(int i = 1;i<=N;i++){ cin>>arr[i]; if(arr[i]<=T)continue; if(v.empty()||v.back().sc != i-1)v.push_back(pii(i,i)); else v.back().sc++; } for(auto &[s,e]:v){ int c = 1; if(s == 1)c--; seq[c].push_back(e-s+1); } for(auto &i:seq)sort(i.rbegin(),i.rend()); for(int i = 0;i<D;i++)ans -= seq[1][i]; for(auto &i:seq[0])ans -= i; cout<<ans<<'\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...