I am not getting how [this][1] O(Q*N) submission of mine is getting 100 points.
My approach :
First I created a vector of pair in which i stored every element's value and index. Then I sorted this vector.
For first query I used an algorithm similar to one used in insertion sort. And for query 2 I just traversed
the array from backward and checked the conditions for an element, whether its index is between l and r .
[1]: https://www.codechef.com/viewsolution/17665748