Submission #520826

# Submission time Handle Problem Language Result Execution time Memory
520826 2022-01-31T05:49:16 Z beg Telefoni (COCI17_telefoni) C++17
80 / 80
38 ms 860 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
int cost = 0, n,tmp, d,c;
main(){
	cin >> n >> d;
	for(int i = 1; i <= n; i++){
		cin >> tmp;
		if(tmp == 0 && i-c >=d){
			cost++;
			c = i;
		}
		if(tmp == 1) c= i;
	}
	cout <<cost;
}
		
	

Compilation message

telefoni.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 236 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Correct 38 ms 840 KB Output is correct
9 Correct 36 ms 860 KB Output is correct
10 Correct 35 ms 840 KB Output is correct