class Solution:

    def findMaximizedCapital(self, k: int, w: int, profits: List[int], capital: List[int]) -> int:

        n = len(profits)

        proj = sorted(zip(capital, profits))

        a = []

        i = 0

        for _ in range(k):

            while i < n and proj[i][0] <= w:

                heappush(a, -proj[i][1])

                i += 1

            if a:

                w -= heappop(a)

            else:

                break

        return w


하드라서 쫄았는데 막상 풀어보니 별로 안 어려웠음