Hi..
Given an array a that containes 2n elements each element has han an occurrence of 2 in the array.
so {1,2,4,1,4,2} would be an example, Now we have Q queries each query is asking for the maximum element on the segment L...R,but if the element has 2 occurrences on the segment L...R it will not be counted.
so if a={1,2,4,1,4,2} and query={2,6} the answer will be 1 because 4 and 2 will not be counted.
I think I can solve this uning Mo algorithm but I want a segment tree aproach.
Any help would be great, Thank you for reading.