728x90
https://www.acmicpc.net/problem/11000
import heapq
import sys
input = sys.stdin.readline
N = int(input())
course = list()
answer = 1
for i in range(N):
S, T = map(int, input().split())
course.append((S, T))
course.sort()
classroom = list()
heapq.heappush(classroom, course[0][1])
for i in range(1, N):
compare = course[i]
nearest_class = heapq.heappop(classroom)
if nearest_class <= compare[0]:
heapq.heappush(classroom, compare[1])
else:
heapq.heappush(classroom, nearest_class)
heapq.heappush(classroom, compare[1])
answer += 1
print(answer)
728x90
'Study > Coding Test' 카테고리의 다른 글
[백준] 17070 - 파이프 옮기기1 Python (0) | 2023.05.23 |
---|---|
[백준] 10815 - 숫자 카드 Python (0) | 2023.05.23 |
[백준] 2839 - 설탕 배달 Python (0) | 2023.05.23 |
[백준] 2839 - 설탕 배달 Python (0) | 2023.05.22 |
[백준] 2468 - 안전 영역 Python (0) | 2023.05.22 |