#include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll n,k,x,d,ans=0;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>k;
for (ll i=1;i<=n;i++){
cin>>x;
if (x==1) d=0;
else if (x==0) d++;
if (d==k){
d=0;
ans++;
}
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
10 ms |
860 KB |
Output is correct |
9 |
Correct |
10 ms |
860 KB |
Output is correct |
10 |
Correct |
9 ms |
860 KB |
Output is correct |