제출 #1306687

#제출 시각아이디문제언어결과실행 시간메모리
1306687tabTelefoni (COCI17_telefoni)C++20
80 / 80
11 ms2632 KiB
#include "bits/stdc++.h" using namespace std; #define intt long long #define fi first #define se second #define endl "\n" const intt mxN = 2e5+67; const intt LG = 31; const intt inf = 1e18; const intt mod = 1e9 + 7; void smile() { intt n, d; cin >> n >> d; vector<intt> a(n); for(intt i = 0; i < n; i++) { cin >> a[i]; } intt move = d, r = 0, ans = 0; while(r < n) { while(move > 0 && r < n) { // cout << r << "w" << endl; r++; move--; if(a[r] == 1) move = d; } if(r > n - 1) break; if(a[r] == 0) { move = d; ans++; } else { move = d; } } cout << ans << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // freopen("island.in", "r", stdin); // freopen("island.out", "w", stdout); intt t = 1, buu = 1; // cin >> t; while(t--){ // cout << "Case #" << buu++ << ": "; smile(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...