sumq
to store the sum of qualities in the heap.sumq
and to the max heap.
b. If the heap size exceeds k
, remove the largest quality from sumq
and the heap.
c. If the heap size is exactly k
, calculate the potential cost as the current worker's ratio multiplied by sumq
.
d. Keep track of the minimum cost encountered.