LeetCode 857. Minimum Cost to Hire K Workers

The below code is giving TLE. why?

Approach I have used while implementing this CODE basically I have made all the workers captain one by one and calculated the cost. If offering wage is greater than equal to expected wage we put it in max priority queue of size k after this I add up all the elements of priority queue.