Submission #521506

#TimeUsernameProblemLanguageResultExecution timeMemory
521506huangqrTelefoni (COCI17_telefoni)C++14
80 / 80
20 ms964 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
const ll lim=5e5+5,mod=1e9+7;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll n,d,ans=0,ctr=0;
	cin>>n>>d;
	while(n--){
		bool x;
		cin>>x;
		if(x==0){
			ctr++;
			if(ctr>=d){
				ctr=0;
				ans++;
			}
		}
		else ctr=0;
	}
	cout<<ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...