Submission #32885

# Submission time Handle Problem Language Result Execution time Memory
32885 2017-10-16T18:49:27 Z Dat160601 Telefoni (COCI17_telefoni) C++14
80 / 80
23 ms 4520 KB
#include <bits/stdc++.h>
using namespace std;
long long n,a[300007],ans=0,d,coun=0;
int main(){
    ios_base::sync_with_stdio(0);
    cin>>n>>d;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++){
        if(a[i]==1) coun=0;
        else coun++;
        if(coun==d){
            coun=0;
            ans++;
        }
    }
    cout<<ans;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 4520 KB Output is correct
2 Correct 0 ms 4520 KB Output is correct
3 Correct 0 ms 4520 KB Output is correct
4 Correct 0 ms 4520 KB Output is correct
5 Correct 0 ms 4520 KB Output is correct
6 Correct 0 ms 4520 KB Output is correct
7 Correct 0 ms 4520 KB Output is correct
8 Correct 23 ms 4520 KB Output is correct
9 Correct 23 ms 4520 KB Output is correct
10 Correct 19 ms 4520 KB Output is correct