text: class Solution:
      def mincostToHireWorkers(self, quality, wage, K):
          """
          :type quality: List[int]
          :type wage: List[int]
          :type K: int
          :rtype: float
          """
          sorted_ratio = sorted((w / q, q) for w, q in zip(wage, quality))
          heap = []
          qsum = 0
          res = float('inf')
          for r, q in sorted_ratio:
              heapq.heappush(heap, -q)
              qsum += q
              if len(heap) > K: qsum += heapq.heappop(heap)
              if len(heap) == K: res = min(res, qsum * r)
          return res