Please Debug My Code [JAN LUNCHTIME DIV2] [WTCH]

Question: https://www.codechef.com/LTIME68B/problems/WTCH

My Code: https://www.codechef.com/viewsolution/22644422

My logic was that I surround the 1s of the string with 0s, then consider the subarrays between the "010"s as empty subarrays and then use the result of first subtask i.e. (N-1)/2+1. Answer would be sum of answer of these subarrays.

Please debug this code or tell me a case where it fails.

I guess you didn’t checked the code for multiple test cases. :stuck_out_tongue:

You didn’t assign value of variable count=0 after each test case.

Yours solution with the above change gave AC.link