Submission #151307

# Submission time Handle Problem Language Result Execution time Memory
151307 2019-09-02T12:20:42 Z Linca_Robert Telefoni (COCI17_telefoni) C++14
80 / 80
79 ms 1016 KB
#include<bits/stdc++.h>
using namespace std;

int N, x, last, ans, D;
int main(){
    cin >> N >> D >> x;
    last = 1;
    for( int i = 2; i <= N; i++ ){
        cin >> x;
        if( x == 1 ){
            if( i - last > D ){
                ans += (i - last) / D;
                if( (i - last) % D == 0 )
                    ans--;
            }
            last = i;
        }
    }
    cout << ans << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 360 KB Output is correct
4 Correct 2 ms 360 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 79 ms 888 KB Output is correct
9 Correct 77 ms 944 KB Output is correct
10 Correct 76 ms 1016 KB Output is correct