Hostel visit problem

sir/Mam,
test case failed why?

hello @Korou
image

here for query of type 1 ,
if pq.size() < k then simply push the new distance in heap
othewise
compare the distance pq.top() with rocketdis
if pq.top() > roketdis then pop top element from the heap and insert rocketdis in place of that


sir,still failed.

why r popping element from heap , for query 2.
dont do that
u only have to print

sir ,now it is fine all test case passed but in this code https://ide.codingblocks.com/s/259178
that i have written that sample test case is passed.so what the mistake that i made can you explain.

a) use long long for priority queue
b) remove pop statement from query 2
i think after making these changes ur code should work.
pls submit and let me know what verdict u r getting

ok fine it works now ,that pop() make me in trouble.THANK A LOT SIR FOR YOUR HELP.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.