Editorial is pretty much clear… and explanatory… but can anyone plzz help me how to built a query function… means how can query for the range like 4 to 7 in segment tree when array size,n=8 only summing of node.ans is not enough so i am not able to manipulate how count1 and count2 is added… or it is to be added to find ans in the same way like in merge operation explained above…
please explain it…Would be very much thankful if anybody can help me to understand…