Skip to content

Commit

Permalink
Merge pull request #263 from AlgoLeadMe/38-H0ngJu
Browse files Browse the repository at this point in the history
38-H0ngJu
  • Loading branch information
H0ngJu authored Jan 17, 2025
2 parents 1c2931b + ca885ee commit 5acb83c
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys
import heapq

def input() : return sys.stdin.readline().rstrip()

N = int(input()) # 100000
info = [tuple(map(int, input().split())) for _ in range(N)]
room = []

info.sort(key=lambda x: x[0])
heapq.heappush(room, info[0][1])
answer = 1

for i in range(1,N):
a, b = info[i][0], info[i][1]
if a >= room[0]:
heapq.heappop(room)
heapq.heappush(room, b)

print(len(room))

0 comments on commit 5acb83c

Please sign in to comment.