# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23097 | model_code | Telefoni (COCI17_telefoni) | C++11 | 23 ms | 1116 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 <cstdio>
#include <string>
#include <vector>
#include <map>
#include <cstdlib>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long llint;
typedef pair <int, int> pii;
int n, d;
int main (void){
scanf("%d%d", &n, &d);
int last = 0;
int ans = 0;
for (int i = 0; i < n; ++i) {
int x; scanf("%d", &x);
if (x == 1) last = i;
if (i - last == d) {
++ans;
last = i;
}
}
printf("%d\n", ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |