#define _USE_MATH_DEFINES 1
#define _EXT_CODECVT_SPECIALIZATIONS_H 1
#define _EXT_ENC_FILEBUF_H 1
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
#define MOD 1000000007ll
#define EPS 1e-9
typedef long long ll;
typedef long double ld;
typedef pair <ll,ll> pl;
typedef tuple <ll,ll,ll> tl;
ll N, D, L, T;
vector <ll> tele;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> D;
for (ll i = 1; i <= N; i++) {
char state;
cin >> state;
if (state == '1') tele.push_back(i);
}
for (ll i = 1; i < (ll)tele.size(); i++) {
T += (tele[i] - tele[i-1] - 1) / D;
}
cout << T;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
11 ms |
1020 KB |
Output is correct |
9 |
Correct |
12 ms |
888 KB |
Output is correct |
10 |
Correct |
11 ms |
888 KB |
Output is correct |