| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1339468 | ninstroyer | Telefoni (COCI17_telefoni) | C++20 | 9 ms | 1604 KiB |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int nx = 3e5+5;
int n,d,res,a[nx];
int main()
{
ios::sync_with_stdio(false); cin.tie(0);
cin>>n>>d;
for(int i = 1; i <= n; i++) cin>>a[i];
int i = 2;
int dist = 1;
while(i<=n)
{
if(dist==d&&!a[i]) res++,i++,dist=1;
else if(a[i]) dist=1,i++;
else dist++,i++;
}
cout<<res;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
