제출 #1172291

#제출 시각아이디문제언어결과실행 시간메모리
1172291apelpisiaTelefoni (COCI17_telefoni)C++20
80 / 80
8 ms328 KiB
#include <bits/stdc++.h>

#define pb push_back
#define f first
#define s second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> ii;

const int INF = 1e9;
int i, j, k;

const int nx = 300005;
int n, d, ans = 0, p = 1, temp;

int main(int argc, char **argv){
    cin.tie(NULL)->sync_with_stdio(false);
    cin >> n >> d >> temp;
    for(i=2; i<=n; i++){
        cin >> temp;
        if(temp==1) p = i;
        else if(i-p>=d){
            ans++;
            p = i;
        }
    }
    cout << ans;

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...