CAKEDOOM: Getting wa

This is the problem in June 2012 Long Challenge. Can anybody point out why i got WA in this problem.
Here is the solution link

I tried it and it returns

0

for input

1
0?

and it’s not stopping for input

1
01
1 Like

You deal with the case K=2 in a wrong way. You can’t set first character for K=2 only looking at its neighbors. Try this test:

2
??1?
3 Likes

Can anybody point out why i got WA in this problem. click here for my solution

I have checked again. Please check this solution. Please point out why i got WA. Thank you.

thanx. got it

got correct results for your test cases

try this input:

2
1
?
2
?