Does someone know how to solve QCHEF using Segment Trees?

I have feeling that it is always possible to solve such type of problems using Segment Trees, however it is not that intuitive as using Mo’s algorithm instead. Is here anyone who knows or saw a solution using Segment Trees? I’d appreciate it if someone could give me an explanation. Thanks in advance!

i dont think it was possible to code it with segment trees

@dudechandan has solved it
his solution-
http://www.codechef.com/viewsolution/6497315

how we can invite him here to have discussion with us?