APS排产相关的leetcode

发布时间:2024年01月17日

1834 Single-Threaded CPU

class Solution:
    def getOrder(self, tasks: List[List[int]]) -> List[int]:
        for i, task in enumerate(tasks):
            task.append(i)
        tasks.sort()
        ans = []
        q = []
        n = len(tasks)
        i = t = 0
        while q or i < n:
            if not q:
                t = max(t, tasks[i][0])
            while i < n and tasks[i][0] <= t:
                heappush(q, (tasks[i][1], tasks[i][2]))
                i += 1
            pt, j = heappop(q)
            ans.append(j)
            t += pt
        return ans

621 Task Scheduler

630 Course Schedule III

1029 Two City Scheduling

1229 Meeting Scheduler

2365 Task Scheduler II

1335 Minimum Difficulty of a Job Schedule

1462 Course Schedule IV

207 Course Schedule

210 Course Schedule II

文章来源:https://blog.csdn.net/weixin_38812492/article/details/135651530
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。