Submission #211789

#TimeUsernameProblemLanguageResultExecution timeMemory
211789skytectTelefoni (COCI17_telefoni)C++17
80 / 80
27 ms1024 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios::sync_with_stdio(0); cin.tie(0); ll n, d; cin >> n >> d; ll cnt1 = 0, cnt2 = 0; for (ll i = 0; i < n; ++i) { bool b; cin >> b; if (b) { if (cnt2) { cnt1 += cnt2 / d; cnt2 = 0; } } else { ++cnt2; } } cout << cnt1; }
#Verdict Execution timeMemoryGrader output
Fetching results...