# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1271757 | cbnk32_tuandung | Telefoni (COCI17_telefoni) | C++17 | 29 ms | 584 KiB |
#include <bits/stdc++.h>
using namespace std;
bool a[300009];
int main() {
int n,d; cin >> n >> d;
for (int i = 1; i <= n; ++i) cin >> a[i];
int res=0;
int voi=d+1;
for (int i = 2; i < n;++i) {
if (a[i]) voi=i+d;
else {
if (i==voi) {
voi+=d;
++res;
// cout << i << endl;
}
}
}
cout << res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |