Iam getting wrong answer for DYZIO. https://www.spoj.pl/problems/DYZIO/.
Can any give test cases on which my program output wrong answer?
int main()
{
int n;
while(scanf("%d", &n) > 0)
{
int cuts = 0;
char str[20009];
scanf("%s", str);
string st(str);
int p = 0, sz = st.size();
if (str[0] == '0') printf("0\n");
else
{
deque<int> dq;
dq.push_back(sz>>1);
dq.push_back(sz>>1);
if (dq[p] == 1) p += 2;
++cuts;
for(int i = 1; ((p<dq.size()) && i < sz); ++i)
{
if (str[i] == '1')
{
int ls = dq[p]>>1;
++cuts;
dq.erase(dq.begin() + p);
dq.insert(dq.begin() + p, ls);
dq.insert(dq.begin() + p + 1, ls);
if (ls == 1) p += 2;
// copy(dq.begin(), dq.end(), ostream_iterator<int>(cout, " "));
}
else ++p;
// printf(" i=%d\n ", i);
}
printf("%d\n", cuts);
}
}
return 0;
}