https://www.codechef.com/viewsolution/60394512
Logic is , when i have the group of (maximum odd zeros and their length is)/2+1 > second maximum group of zeros . then only the player wins .
for the corner case if we have only one group and it is odd , then also player wins otherwise no.
There were two mistakes.

You are only pushing lengths if it is followed by a blocked cell. What if last cell is not blocked ? To fix this just check.length > 0
after thefor
loop and update thefreq
if so 
freq.end  1
is theiterator
to the last element not the second last.
Check this corrected code.
1 Like
Thank you very much for helping me i get the AC
And for the first mistake , it is given in question last block would always be blocked.
Sir , if end() function reference to last element then , why we used end()2
1 Like
to find the second last element of vector