# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
604781 | hibiki | The short shank; Redemption (BOI21_prison) | C++11 | 68 ms | 9044 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;
int n, d, t;
int a[2000005], re[2000005];
int ans = 1e9, lst = -1e9, cnt = 0;
priority_queue<int> g;
int main()
{
scanf("%d %d %d", &n, &d, &t);
for(int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
re[i] = re[i - 1];
if(a[i] <= t) re[i]++, lst = i;
else if(i - lst <= t) re[i]++;
}
lst = n + 1;
for(int i = n; i > 1; i--)
{
if(a[i] <= t)
{
cnt++;
cnt += min(t - a[i], lst - i - 1);
lst = i;
}
ans = min(ans, cnt + re[i - 1]);
}
printf("%d\n",ans);
return 0;
}
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... |