Unable to find which edge case I'm missing. Only 1 test case passed out of 5

Made use of policy based DS to optimise finding the k’th nearest hostel. But seems like it doesn’t hold well for other cases. Please let me know what I’m missing.

hello @neelkanthpoosa

pls save ur code at cb ide and share its link with me

Here.

your solution will discard duplicate entries due to which it is giving wrong entries

I also tried using pair<int,int> to make it accept multiple entries, same result.

what u r giving in second of pajr,
share ur updated code with me

First one takes the distance value, next one is random index Im assigning to make it accept the value even if its a duplicate.

use long long for x,y

1 Like

DAMN. Thanks man. Very silly thing. :open_mouth:

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.