We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d14b33 commit d2a5242Copy full SHA for d2a5242
1 file changed
live9/test92/문제3/백유진.py
@@ -0,0 +1,22 @@
1
+import heapq
2
+
3
+def solution(book_time):
4
+ reservations = []
5
+ for start, end in book_time:
6
+ h, m = map(int, start.split(":"))
7
+ start_min = h * 60 + m
8
+ h, m = map(int, end.split(":"))
9
+ end_min = h * 60 + m + 10 # 청소 시간 포함
10
+ reservations.append((start_min, end_min))
11
+ reservations.sort()
12
13
+ rooms = []
14
15
+ for start, end in reservations:
16
+ if rooms and rooms[0] <= start:
17
+ # 기존 방 사용 가능
18
+ heapq.heappop(rooms)
19
+ # 새 방 배정 (또는 기존 방 갱신)
20
+ heapq.heappush(rooms, end)
21
22
+ return len(rooms)
0 commit comments