# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77106 | 998244353 | Telefoni (COCI17_telefoni) | C++14 | 30 ms | 3660 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<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
int n,d;
int main()
{
scanf("%d %d",&n,&d);
int a[n];
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
int temp=0,ans=0;
for(int i=1;i<n;i++)
{
if(a[i]==1&&i-temp<=d)
temp=i;
else
{
if(i-temp>d)
{
temp=i-1;
ans+=1;
i-=1;
}
}
}
printf("%d",ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |