[Problem][1]
[2]
I am following what is proposed in the editorial. Either the majority element of left half or the majority element of the right half could be the majority element of the node represented by the segment . For achieving this I am using a hashmap at every node and a majority field to store the majority element to store that value. Rest of the part including update and query are done just as in Sum segment tree using the merge function . Can someone help me , I have spent a lot of time on this question.
Thanks in advance :)
[1]: https://www.codechef.com/problems/CHEFLKJ
[2]: https://www.codechef.com/viewsolution/20471173