Submission #522857

# Submission time Handle Problem Language Result Execution time Memory
522857 2022-02-06T05:36:33 Z emptypringlescan Telefoni (COCI17_telefoni) C++14
80 / 80
13 ms 2044 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin >> n >> m;
	int arr[n];
	for(int i=0; i<n; i++) cin >> arr[i];
	int next=0,ans=0;
	for(int i=0; i<n; i++){
		if(arr[i]==1){
			next=i+m;
			continue;
		}
		if(i==next){
			ans++;
			next=i+m;
		}
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 316 KB Output is correct
8 Correct 13 ms 2044 KB Output is correct
9 Correct 13 ms 1988 KB Output is correct
10 Correct 13 ms 1964 KB Output is correct