Submission #247904

# Submission time Handle Problem Language Result Execution time Memory
247904 2020-07-12T06:22:39 Z NONAME Telefoni (COCI17_telefoni) C++14
80 / 80
18 ms 2176 KB
#include <bits/stdc++.h>
#define dbg(x) cerr << #x << " = " << x << "\n"
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie()
using namespace std;
using ll = long long;

int main() {
    fast_io;

    int n, d;
    cin >> n >> d;
    vector <int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    int lst = 0, ans = 0;
    for (int i = 1; i < n; ++i)
        if (a[i] == 1)
            ans += max(0, (i - lst - 1) / d), lst = i;
    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 18 ms 2176 KB Output is correct
9 Correct 17 ms 2176 KB Output is correct
10 Correct 18 ms 2048 KB Output is correct