Submission #854245

#TimeUsernameProblemLanguageResultExecution timeMemory
854245EricmanuelTelefoni (COCI17_telefoni)C++14
16 / 80
31 ms1000 KiB
#include <bits/stdc++.h>
#define ll long long
#define S second
#define F first
#define PB push_back
#define PF push_front
using namespace std;

signed main()
{

    int n , m;
    cin >> n >> m;

    int res = 0;
    int cnt = 1;
    for(int i  = 0; i < n; i++){
        int x;
        cin >> x;
        if( x  == 0 && cnt < m){
            cnt++;
        }
        else if(x == 0){
            res++;
            cnt = 1;
        }
    }
    cout<< res;
    return 0;
}

#Verdict Execution timeMemoryGrader output
Fetching results...