import sys
import heapq
input = sys.stdin.readline
N = int(input())
lectures = []
for _ in range(N):
start, end = list(map(int, input().split()))
lectures.append([start, end])
lectures.sort(key = lambda x:x[0])
heap = []
heapq.heappush(heap, lectures[0][1])
for i in range(1, N):
if heap[0] > lectures[i][0]:
heapq.heappush(heap, lectures[i][1])
else: # heap[0] <= lectures[i][0]
heapq.heappop(heap)
heapq.heappush(heap, lectures[i][1])
print (len(heap))
'Computer Science > 백준 알고리즘' 카테고리의 다른 글
[백준] 11022번 A+B -8 (C/C++) (0) | 2022.06.21 |
---|---|
[백준] 11021 A+B -7 (C++) (0) | 2022.06.21 |
[백준] 10989번 수 정렬하기 3 (파이썬) (0) | 2022.06.21 |
[백준] 10953번 A+B-6 (C/C++) (0) | 2022.06.21 |
[백준] 10952번 A+B-5 (C/C++) (0) | 2022.06.21 |