Merge Sort Tree (BANK123)

Hi, I am trying to solve BANK123 problem using Merge Sort Tree (my solution) . At the time, when two child array are merged, I am calculating the sum of odd and even places and storing the difference so that I can answer queries in say log(n) . But due to some reason, I am getting WA verdict. Can anyone help me with this ? Or if my solution is wrong, can you reason out ?
P.S. Almost all accepted solution uses D.P., hence tagged D.P. as well.