# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1132649 | DangKhoizzzz | Telefoni (COCI17_telefoni) | C++20 | 9 ms | 2736 KiB |
#include <bits/stdc++.h>
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 1e6 + 7;
int n , d , a[maxn];
vector <int> pos;
void solve()
{
cin >> n >> d;
for(int i = 1; i <= n; i++) cin >> a[i];
for(int i = 1; i <= n; i++)
{
if(a[i]) pos.push_back(i);
}
int ans = 0;
for(int i = 1; i < pos.size(); i++)
{
ans += (pos[i] - pos[i-1] - 1)/d;
}
cout << ans << '\n';
}
signed main()
{
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |