# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
521128 | penguin133 | Telefoni (COCI17_telefoni) | C++14 | 42 ms | 2032 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;
int A[300005];
int main(){
int n,d;cin >> n >> d;
for(int i=1;i<=n;i++)cin >> A[i];
int maxi = 1, cnt = 0;
for(int i=2;i<=n;i++){
if(i > maxi + d)maxi = i - 1, cnt++;
if(A[i])maxi = i;
}
cout << cnt;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |