제출 #1315168

#제출 시각아이디문제언어결과실행 시간메모리
1315168ppmn_6Telefoni (COCI17_telefoni)C++20
80 / 80
9 ms360 KiB
#include "bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); // https://codeforces.com/blog/entry/79148 class Timer: chrono::high_resolution_clock { const time_point start_time; public: Timer(): start_time(now()) {} rep elapsed_time() const { return chrono::duration_cast<chrono::milliseconds>(now() - start_time).count(); } } timer; int main() { cin.tie(0); ios::sync_with_stdio(0); int n, d, pr, ans = 0; cin >> n >> d; for (int i = 0; i < n; i++) { int x; cin >> x; if (x) { pr = i; } if (i - pr == d) { ans++; pr = i; } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...