i have tried Two Ways,
But in both the codes i am getting a TLE in test case 1;
Plz Tell Me why is it so separately for both codes.
HOSTEL VISIT CPP
hello @Kush_1312
you are getting tle becuase u are using min heap.
for each query of type two u will pop k elements so in worst case for q such query u will be performing q*k operations which will give tle.
use max heap to answer this query efficiently.
refer this ->

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.