Submission #66521

# Submission time Handle Problem Language Result Execution time Memory
66521 2018-08-11T09:38:42 Z KLPP Telefoni (COCI17_telefoni) C++14
80 / 80
63 ms 3640 KB
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<stdio.h>

using namespace std;

int main(){
	int n,d;
	cin>>n>>d;
	int arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	int next=n-1;
	int cnt=0;
	for(int i=n-2;i>-1;i--){
		if(arr[i]==1)next=i;
		else{
			if(next-i>=d){
				cnt++;
				next=i;
			}
		}
	}cout<<cnt<<endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 712 KB Output is correct
5 Correct 3 ms 712 KB Output is correct
6 Correct 3 ms 712 KB Output is correct
7 Correct 2 ms 712 KB Output is correct
8 Correct 57 ms 2304 KB Output is correct
9 Correct 63 ms 2904 KB Output is correct
10 Correct 57 ms 3640 KB Output is correct