why is this showing timelimit error
HOSTEL VISIT - doubt
Hi @aganunay, your code is storing distances of all the hostels however we need only the kth nearest hostels.
Due to this your printq function consumes large time for Testcase 2. So try to optimize your code in such a way that the priority queue stores only first k nearest hostels every time query of type 1 is given. Also this question can be done without using class and min heap.
Hope this helps
@proram I did that but then it is showing wrong answer in testcase 2
Hi @proRram, pls use max heap and implement the the thing which I said above correctly so that it makes some sense and will actually benefit the program.
Pls try now