제출 #1271757

#제출 시각아이디문제언어결과실행 시간메모리
1271757cbnk32_tuandungTelefoni (COCI17_telefoni)C++17
80 / 80
29 ms584 KiB
#include <bits/stdc++.h> using namespace std; bool a[300009]; int main() { int n,d; cin >> n >> d; for (int i = 1; i <= n; ++i) cin >> a[i]; int res=0; int voi=d+1; for (int i = 2; i < n;++i) { if (a[i]) voi=i+d; else { if (i==voi) { voi+=d; ++res; // cout << i << endl; } } } cout << res; }
#Verdict Execution timeMemoryGrader output
Fetching results...