Hostel Visit TLE

i used the heap approach still getting TLE in 4th (last) test case
cant think of anything new
pls help