Submission #75032

# Submission time Handle Problem Language Result Execution time Memory
75032 2018-09-08T05:07:47 Z charlies_moo Telefoni (COCI17_telefoni) C++
8 / 80
4 ms 1236 KB
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int n,d,ans;
int a[10001];

int main()
{
	cin>>n>>d;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int v;
	for(int i=1;i<=n;i++)
	{
		v=i;
		for(int j=min(d+v,n);j>v;j--)
		{
			if(a[j]==0)
			{
				ans++,a[j]++,i=j-1;
				break;
			}
			if(j==v+1)
				i=j-1;
		}
	}
	cout<<ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Incorrect 2 ms 508 KB Output isn't correct
3 Incorrect 2 ms 640 KB Output isn't correct
4 Incorrect 2 ms 776 KB Output isn't correct
5 Incorrect 2 ms 776 KB Output isn't correct
6 Incorrect 2 ms 800 KB Output isn't correct
7 Incorrect 3 ms 864 KB Output isn't correct
8 Incorrect 4 ms 996 KB Output isn't correct
9 Incorrect 4 ms 1108 KB Output isn't correct
10 Incorrect 4 ms 1236 KB Output isn't correct