# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
209996 | AlainSu | Telefoni (COCI17_telefoni) | C++14 | 69 ms | 632 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;
const int MAXN=3500000;
long long n,m,ans=0,tmp;
bool a[MAXN];
void input()
{
cin>>n>>m;
long long p=1;
for (int i=1;i<=n;i++)
{
cin>>a[i];
if (a[i])
{
if (i-p>m)
{
ans+=(i-p)/m;
if ((i-p)%m>0) ans++;
ans--;
}
p=i;
}
}
}
void output()
{
cout<<ans;
}
int main()
{
input();
output();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |