#include <bits/stdc++.h>
#define sts stable_sort
#define B begin()
#define rB rbegin()
#define E end()
#define rE rend()
#define F first
#define S second
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define eb emplace_back
#define ll long long
#define ui unsigned int
#define ull unsigned long long
using namespace std;
const int MAXN = 1e6 + 4;
const int MOD = 1e9 + 7;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n, d; cin >> n >> d;
vector<int> v(n);
for(int i = 0; i < n; i++){
cin >> v[i];
}
ll cnt = 0, res = 0;
for(int i = 0; i < n; i++){
if(v[i])continue;
cnt++;
if(cnt == d){
cnt -= d;
res++;
}
}
cout << res << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
8 |
Incorrect |
18 ms |
1492 KB |
Output isn't correct |
9 |
Incorrect |
14 ms |
1492 KB |
Output isn't correct |
10 |
Incorrect |
20 ms |
1492 KB |
Output isn't correct |