i dont understand why my soln. is wrong??Plz help me. I m stucked past 2 days.

Check my soln https://www.codechef.com/viewsolution/19410708
Please answer clearly.

The link U are providing does not provide ur solution.Can u give another link

U can see the editorial of the problem “https://discuss.codechef.com/questions/132596/splst-editorial

I guess u are going wrong with the condition part.

check it now https://www.codechef.com/viewsolution/19410708