# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
405956 | Halogen | The short shank; Redemption (BOI21_prison) | C++14 | 76 ms | 5352 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int N, D, T;
int A[2000005];
main() {
scanf("%lld %lld %lld", &N, &D, &T);
for (int i = 0; i < N; i++) scanf("%lld", &A[i]);
priority_queue<int> pq;
int ans = 0;
int l = -1 + (A[0] > T), r = 0;
for (int i = 0; i <= N; i++) {
if (A[i] > T) {
if (l == -1) l = i;
r = i;
}
else {
if (l == 0) {
ans += r - l + 1;
}
else if (l != -1) {
pq.push(r - l + 1);
// printf("%lld\n", r - l + 1);
}
l = -1;
r = i;
}
}
for (int i = 0; i < D; i++) {
ans += pq.top();
pq.pop();
}
printf("%lld", N - ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |