๋ฌธ์
https://www.acmicpc.net/problem/11000
ํ์ด
# ๋ฐฑ์ค 11000๋ฒ ๋ฌธ์ - ๊ฐ์์ค ๋ฐฐ์
import sys
import heapq
input = sys.stdin.readline
if __name__ == "__main__":
n = int(input())
schedule_list = [list(map(int, input().split())) for _ in range(n)]
schedule_list.sort()
room_queue = list()
heapq.heappush(room_queue, schedule_list[0][1])
for i in range(1, n):
if schedule_list[i][0] >= room_queue[0]:
heapq.heappop(room_queue)
heapq.heappush(room_queue, schedule_list[i][1])
print(len(room_queue))
์ฐ์ ์์ ํ๋ฅผ ์ด์ฉํ ํ์ด
'๐๏ธ Algorithm > ๐ฉ ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๐ฉ [๋ฐฑ์ค] [Python] [Silver1] 11660๋ฒ_๊ตฌ๊ฐ ํฉ ๊ตฌํ๊ธฐ 5 (0) | 2023.03.25 |
---|---|
๐ฉ [๋ฐฑ์ค] [Python] [Silver2] 18111๋ฒ_๋ง์ธํฌ๋ํํธ (0) | 2023.03.20 |
๐ฉ [๋ฐฑ์ค] [Python] [Silver4] 10825๋ฒ_๊ตญ์์ (0) | 2023.03.18 |
๐ฉ [๋ฐฑ์ค] [Python] [Gold3] 1600๋ฒ_๋ง์ด ๋๊ณ ํ ์์ญ์ด (0) | 2023.03.16 |
๐ฉ [๋ฐฑ์ค] [Python] [Gold4] 17298๋ฒ_์คํฐ์ (1) | 2023.03.15 |