# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
791719 | 2023-07-24T09:03:12 Z | shoryu386 | Telefoni (COCI17_telefoni) | C++17 | 40 ms | 3212 KB |
#include <bits/stdc++.h> using namespace std; #define int long long main(){ int n, d; cin >> n >> d; int cringe[n]; for (int x = 0; x < n; x++) cin >> cringe[x]; int lastOne = 0; int ans = 0; for (int x = 0; x < n; x++){ if (cringe[x] == 1) lastOne = x; if (x - lastOne >= d) ans++, lastOne = x; } cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 328 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 300 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 40 ms | 3212 KB | Output is correct |
9 | Correct | 36 ms | 3212 KB | Output is correct |
10 | Correct | 34 ms | 3136 KB | Output is correct |