Problem with a codeforces question

Link for the question: Problem - D - Codeforces
Editorial: Разбор задач Codeforces Round #137 (Div. 2) - Codeforces
Here , i got confused after looking at the editorial because there its mentioned something what i did here Submission #75558458 - Codeforces . But look at my other submission Submission #75558458 - Codeforces . In both case the only difference is the pointer that i am increasing in else case. My doubt is : after reading the question it seems it should be symmetric as there is no special feature of any array then why only one of the code got accepted??