Submission #151307

#TimeUsernameProblemLanguageResultExecution timeMemory
151307Linca_RobertTelefoni (COCI17_telefoni)C++14
80 / 80
79 ms1016 KiB
#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 timeMemoryGrader output
Fetching results...