#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 time |
Memory |
Grader output |
1 |
Correct |
0 ms |
308 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
20 ms |
964 KB |
Output is correct |
9 |
Correct |
17 ms |
804 KB |
Output is correct |
10 |
Correct |
17 ms |
808 KB |
Output is correct |