제출 #866947

#제출 시각아이디문제언어결과실행 시간메모리
866947Mizo_CompilerThe short shank; Redemption (BOI21_prison)C++17
0 / 100
81 ms14428 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double ld; #define pb push_back #define sz(x) int(x.size()) #define all(x) x.begin(),x.end() #define F first #define S second const int N = 2e6+5; int n, a[N], d, t; int main () { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> d >> t; int ans = 0; int cnt = 0; multiset<int, greater<>> s; for (int i = 0; i < n; i++) { cin >> a[i]; a[i] = (a[i] <= t); if (a[i]) { ans++; s.insert(cnt); cnt = 0; } else { cnt++; } } if (!ans) { cout << ans << "\n"; return 0; } s.insert(cnt); ans = n; int x = min(sz(s), d); while (x--) { ans -= *s.begin(); s.erase(s.begin()); } cout << ans << "\n"; }
#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...