Submission #856080

# Submission time Handle Problem Language Result Execution time Memory
856080 2023-10-02T16:23:55 Z vjudge1 Telefoni (COCI17_telefoni) C++17
80 / 80
13 ms 456 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast,O3,unroll-loops")
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpi vector<pii>
#define vvpi vector<vpi>
#define vb vector<bool>
#define vvb vector<vb>
#define endl "\n"
#define sp << " " <<
#define F(i, s, n) for(int i = s; i < n; i++)
#define pb push_back
#define fi first
#define se second
int mod = 998244353;

int inf = LLONG_MAX >> 3;

int mult(int x, int y) {
    return (x%mod)*(y%mod)%mod;
}

void solve() {
    int n, k;
    cin >> n >> k;
    int c = 0;
    int ans = 0;
    F(i, 0, n) {
        int x;
        cin >> x;
        if(x == 0) c++;
        else {
            ans += c / k;
            c = 0;
        }
    }
    cout << ans << endl;
}

void setIO() {
    ios::sync_with_stdio(0); cin.tie(0);
    #ifdef Local
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
}
signed main() {
    setIO();
    int t = 1;
    //cin >> t;
    while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 13 ms 456 KB Output is correct
9 Correct 11 ms 348 KB Output is correct
10 Correct 11 ms 348 KB Output is correct