# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
791719 | shoryu386 | Telefoni (COCI17_telefoni) | C++17 | 40 ms | 3212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
main(){
int n, d; cin >> n >> d;
int cringe[n]; for (int x = 0; x < n; x++) cin >> cringe[x];
int lastOne = 0;
int ans = 0;
for (int x = 0; x < n; x++){
if (cringe[x] == 1) lastOne = x;
if (x - lastOne >= d) ans++, lastOne = x;
}
cout << ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |