Skip to content

Commit

Permalink
2025-01-06
Browse files Browse the repository at this point in the history
  • Loading branch information
H0ngJu committed Jan 5, 2025
1 parent 00438a2 commit ca885ee
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 ca885ee

Please sign in to comment.