https://hack.codingblocks.com/contests/c/547/1629
trying with random access method in BST
test case 1 passed getting WA in case 2
plz help
Hostel_visit stl problem 3
You can use just max heap and insert aa + bb until the size of heap is k , from now if aa + bb is less than top of heap then insert this in heap otherwise leave it (because its of no use even if we add it to out heap ) and for query of type 2 you just print the top element of heap
I hope you get the idea
thanks have solved by this method but it would be great if u help me with the approach posted in ideone link
Yeah Sure !
Actuallythe policy based tree that you are using will contain only unique elements
So, suppose you have a tree and you are trying to insert 1,1,1,1,1
and if you access *t.find_by_order(k) then you will get 0 for k>0 as it only contains the element 1
Did you get it ?
1 Like
thnx a lot…sir