diff --git a/백준/Gold/11000. 강의실 배정/README.md b/백준/Gold/11000. 강의실 배정/README.md new file mode 100644 index 0000000..9619118 --- /dev/null +++ b/백준/Gold/11000. 강의실 배정/README.md @@ -0,0 +1,36 @@ +# [Gold V] 강의실 배정 - 11000 + +[문제 링크](https://www.acmicpc.net/problem/11000) + +### 성능 요약 + +메모리: 62456 KB, 시간: 300 ms + +### 분류 + +자료 구조, 그리디 알고리즘, 우선순위 큐, 정렬 + +### 제출 일자 + +2025년 4월 3일 14:39:21 + +### 문제 설명 + +
수강신청의 마스터 김종혜 선생님에게 새로운 과제가 주어졌다.
+ +김종혜 선생님한테는 Si에 시작해서 Ti에 끝나는 N개의 수업이 주어지는데, 최소의 강의실을 사용해서 모든 수업을 가능하게 해야 한다.
+ +참고로, 수업이 끝난 직후에 다음 수업을 시작할 수 있다. (즉, Ti ≤ Sj 일 경우 i 수업과 j 수업은 같이 들을 수 있다.)
+ +수강신청 대충한 게 찔리면, 선생님을 도와드리자!
+ +### 입력 + +첫 번째 줄에 N이 주어진다. (1 ≤ N ≤ 200,000)
+ +이후 N개의 줄에 Si, Ti가 주어진다. (0 ≤ Si < Ti ≤ 109)
+ +### 출력 + +강의실의 개수를 출력하라.
+ diff --git a/백준/Gold/11000. 강의실 배정/강의실 배정.py b/백준/Gold/11000. 강의실 배정/강의실 배정.py new file mode 100644 index 0000000..6b6e858 --- /dev/null +++ b/백준/Gold/11000. 강의실 배정/강의실 배정.py @@ -0,0 +1,26 @@ +import sys +import heapq + +input = sys.stdin.readline + +n = int(input()) + +table = [] + +for _ in range(n): + start, end = map(int, input().split()) + table.append((start, end)) + +table.sort() + +rooms = [] + +heapq.heappush(rooms, table[0][1]) + +for i in range(1, n): + if table[i][0] >= rooms[0]: + heapq.heappop(rooms) + + heapq.heappush(rooms, table[i][1]) + +print(len(rooms)) \ No newline at end of file