Submission #75824

# Submission time Handle Problem Language Result Execution time Memory
75824 2018-09-11T08:29:35 Z charlies_moo Telefoni (COCI17_telefoni) C++
80 / 80
66 ms 3512 KB
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int n,d,ans=0;
int a[300001];

int main()
{
	cin>>n>>d;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int v=1;
	for(int i=1;i<=n;i++)
	{
		if(a[i])
			v=i;
		else if(v+d==i)
		{
			v=i;
			ans++;
		}
	}
	cout<<ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 480 KB Output is correct
3 Correct 2 ms 496 KB Output is correct
4 Correct 2 ms 536 KB Output is correct
5 Correct 2 ms 540 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 66 ms 2308 KB Output is correct
9 Correct 58 ms 2908 KB Output is correct
10 Correct 60 ms 3512 KB Output is correct