Problem - https://www.codechef.com/COOK109B/problems/PEPPERON/

While in contest, this was my first approach to solve this problem, but i don’t know where it fails.

https://www.codechef.com/viewsolution/26004700

Idea Overview:

1 - if(1st_half_sum>2nd_half_sum) then find the row with max value of (h2-h1) ,and reverse it and update answer.

2 - if(1st_half_sum<2nd_half_sum) then find the row with max value of (h1-h2) ,and reverse it and update answer.

Later during contest, i managed to write solution with other idea and it got accepted,but i want to know where this solution possibly fails. I know this code is too much implementation :\

Thanks in advance