Codecraft :: problem GIVEAWAY

This question appeared in CodeCraft 2014 and for practice it is
available here:-

I came to know about a solution to this problem that involved creating a AVL Tree at each node of Segment tree and then doing updations and query with the corresponding AVL Tree.
I was wondering if there is some other solution to this problem…
thanks in advance :slight_smile:

//