# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147578 | 2019-08-30T07:20:39 Z | Ruxandra985 | Telefoni (COCI17_telefoni) | C++14 | 28 ms | 1528 KB |
#include <cstdio> using namespace std; int v[300010]; int main() { int n,d,i,latest,add=0; scanf ("%d%d",&n,&d); for (i=1;i<=n;i++) scanf ("%d",&v[i]); latest = 1; for (i=2;i<=n;i++){ if ( i - latest == d ){ if (!v[i]){ add++; latest = i; } } if (v[i]) latest = i; } printf ("%d",add); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 276 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 424 KB | Output is correct |
8 | Correct | 28 ms | 1528 KB | Output is correct |
9 | Correct | 28 ms | 1400 KB | Output is correct |
10 | Correct | 28 ms | 1528 KB | Output is correct |