Skip to content

Commit

Permalink
2024-03-19
Browse files Browse the repository at this point in the history
  • Loading branch information
pknujsp committed Mar 19, 2024
1 parent 37805ad commit 94e034c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pknujsp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@
| 35์ฐจ์‹œ | 2024.02.18 | ๊ทธ๋ฆฌ๋”” | [์„ ๋ฌผํ• ์ธ](https://www.acmicpc.net/problem/25947) | [#137](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/137) |
| 36์ฐจ์‹œ | 2024.02.21 | ์ด์ง„ํƒ์ƒ‰ | [ํœด๊ฒŒ์†Œ ์„ธ์šฐ๊ธฐ](https://www.acmicpc.net/problem/1477) | [#143](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/143) |
| 37์ฐจ์‹œ | 2024.03.04 | ๊ตฌํ˜„ | [n+1 ์นด๋“œ๊ฒŒ์ž„](https://school.programmers.co.kr/learn/courses/30/lessons/258707) | [#149](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/149) |
| 38์ฐจ์‹œ | 2024.03.08 | BRUTE_FORCE | [์ž๋ฌผ์‡ ์™€ ์—ด์‡ ](https://school.programmers.co.kr/learn/courses/30/lessons/60059) | [#154](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/154) |
| 38์ฐจ์‹œ | 2024.03.08 | BRUTE_FORCE | [์ž๋ฌผ์‡ ์™€ ์—ด์‡ ](https://school.programmers.co.kr/learn/courses/30/lessons/60059) | [#154](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/154) |
| 39์ฐจ์‹œ | 2024.03.19 | ํ | [๋””์Šคํฌ ์ปจํŠธ๋กค๋Ÿฌ](https://school.programmers.co.kr/learn/courses/30/lessons/42627) | [#163](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/163) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from heapq import *
from collections import *

def solution(jobs):
jobs = deque(sorted(jobs))
jobs_num = len(jobs)

curr_time = wait_time = 0
heap = []

while heap or jobs:
while jobs and jobs[0][0] <= curr_time:
requested_time, duration = jobs.popleft()
heappush(heap, (duration, requested_time))

if heap:
duration, requested_time = heappop(heap)

curr_time += duration
wait_time += curr_time - requested_time
else:
curr_time += 1

return wait_time // jobs_num

0 comments on commit 94e034c

Please sign in to comment.