Given a list of tasks, each represented by a tuple (task_id, duration, dependencies) where task_id is a unique identifier, duration is the time required to complete the task, and dependencies is a list of task IDs that must be completed before this task, determine the minimum time required to complete all tasks.
You may assume that all tasks can be completed and there are no circular dependencies.
Example 1:
Input: tasks = [(1, 3, []), (2, 2, [1]), (3, 1, [1, 2])]
Output: 6
Explanation: Task 1 takes 3 units of time, task 2 takes 2 units (after task 1), and task 3 takes 1 unit (after tasks 1 and 2). Total = 3 + 2 + 1 = 6.
Example 2:
Input: tasks = [(1, 5, []), (2, 3, [1]), (3, 2, [1, 2]), (4, 1, [3])]
Output: 11
Explanation: The completion order is task 1 (5) -> task 2 (3) -> task 3 (2) -> task 4 (1). Total = 5 + 3 + 2 + 1 = 11.
1 <= tasks.length <= 10^40 <= duration <= 1000tasks = [(1, 3, []), (2, 2, [1]), (3, 1, [1, 2])]Output6WhyTask 1 takes 3 time, Task 2 takes 2 after Task 1, and Task 3 takes 1 after both Task 1 and Task 2.tasks = [(1, 5, []), (2, 3, [1]), (3, 2, [1, 2]), (4, 1, [3])]Output11WhyTask 1 takes 5, Task 2 takes 3 after Task 1, Task 3 takes 2 after Tasks 1 and 2, and Task 4 takes 1 after Task 3.1 <= tasks.length <= 10^4Each task_id is unique and positive.0 <= duration <= 1000def min_project_time(tasks: list[tuple[int, int, list[int]]]) -> int: