HOSTEL VISIT CPP


I am getting a TLE only in 1st testcase why?

@Kush_1312 do not use pow function, it returns double and the value returned is not accurate.
No need do heap sort again and again, Simply make a max heap of size k, as when you have to enter an element compare it with top, if it is greater skip else remove top and insert the element.
It would be better to use priority queue instead of implementing complete heap function yourself. Always take benifit of STL.
If this resolves your doubt mark it as resolved.

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.