Initially, I have given empty list. I have given Q queries, each queries can perform two types of operation on this list as :
1 x y : Insert value x, y times in list.
2 k : Print kth element of sorted list.
Constraints:
1<= Q <= 2*100000
1<= x,y <= 10^9
At any query, k is always less than or equal to list size.
List can have maximum 10^5 different values.
I have tried to solve this using set of pairs, but for each print it takes O(n) time in worst case.
Please, helps in figure out to solve these operation in O(n*log n ) where n stands for maximum size of list.