경쟁 프로그래밍쉬움

작업 순서

'작업 순서 지정' 문제에 대한 자세한 가이드 및 Python 구현입니다.

문제 설명

쉬움

각 튜플이 (job_id, deadline, profit)인 튜플 jobs의 목록을 취하는 job_scheduling(jobs) 함수를 작성하세요. 각 작업을 완료하는 데 1단위의 시간이 걸립니다. 최대 이익과 완료된 작업 수를 찾아 튜플로 (job_count, max_profit)로 반환합니다.

제약
  • 1 <= len(jobs) <= 10^4
  • 1 <= deadline <= 100
  • 1 <= profit <= 1000

Example 1
Input
job_scheduling([(1, 4, 20), (2, 1, 10), (3, 1, 40), (4, 1, 30)])
Output
(2, 60)
Explanation

We can do job 3 at time 1 and job 1 at time 2. Total profit is 40 + 20 = 60.

Example 2
Input
job_scheduling([(1, 2, 100), (2, 1, 19), (3, 2, 27), (4, 1, 25), (5, 3, 15)])
Output
(3, 142)
Explanation

We can do job 1, 3, and 5 for a total profit of 100 + 27 + 15 = 142.

Need a Hint?
세트나 힙과 같은 Greedy 관련 데이터 구조를 사용하는 것을 고려해보세요.
Edge Cases to Watch
  • 빈 입력 구조
  • 단일 요소 입력
  • 큰 수치 범위

해결할 준비가 되셨나요?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

편집기에서 열기
Found this breakdown helpful?

PyRun is built and maintained by an independent solo developer. If this helped your interview prep, consider buying a coffee!

Buy me a coffee

권장 Python 리소스

관련 대화형 튜토리얼, 치트 시트, 코드 비교를 통해 지식을 확장하세요.