#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, d;
cin >> n >> d;
vector <int> v(n);
for(int i = 0; i < n; i++) cin >> v[i];
int sol = 0, left = d - 1;
for(int i = 1; i < n; i++, left--){
if(!v[i] && left == 0){
left = d;
sol++;
}
else if(v[i] && left) left = d;
}
cout << sol;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Correct |
2 ms |
472 KB |
Output is correct |
3 |
Incorrect |
2 ms |
472 KB |
Output isn't correct |
4 |
Correct |
2 ms |
476 KB |
Output is correct |
5 |
Incorrect |
2 ms |
528 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
544 KB |
Output isn't correct |
7 |
Correct |
2 ms |
548 KB |
Output is correct |
8 |
Incorrect |
24 ms |
2384 KB |
Output isn't correct |
9 |
Incorrect |
21 ms |
2972 KB |
Output isn't correct |
10 |
Correct |
35 ms |
3576 KB |
Output is correct |