为甚么????????????

image
image
image

#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	vector<int> wf;
	for (int i = 0; i < n; ++i)
	{
		if (s[i] == '1')
		{
			wf.push_back(i + 1);
		}
	}
	long long cost = 0;
	int laco = 0;
	int wfidx = 0;
	int m = wf.size();
	if (m == 0)
	{
		cost = (long long)n * (n + 1) / 2;
		cout << cost << '\n';
		return 0;
	}
	for (int i = 1; i <= n; )
	{
		if (i <= laco)
		{
			i++;
			continue;
		}
		while (wfidx < m && wf[wfidx] < i - k)
		{
			wfidx++;
		}
		if (wfidx < m && wf[wfidx] <= i + k)
		{
			int pos = wf[wfidx];
			cost += pos;
			laco = min(pos + k, n);
			i = laco + 1;
			wfidx++;
		}
		else
		{
			cost += i;
			laco = i;
			i++;
		}
	}
	cout << cost << "\n";
	return 0;
}

有人吗??