알고리즘 PS
[Python] 백준 #1931 회의실배정
on_doing
2020. 12. 19. 20:57
728x90
1931번: 회의실배정
(1,4), (5,7), (8,11), (12,14) 를 이용할 수 있다.
www.acmicpc.net
그리디 알고리즘.
n=int(input())
t_list=[]
cnt=0
for i in range(n):
meet=list(map(int,input().split()))
t_list.append(meet)
t_list=sorted(t_list,key=lambda x:x[0])
t_list=sorted(t_list,key=lambda x:x[1])
end=0
for i,j in t_list:
if(i>=end):
cnt+=1
end=j
print(cnt)
728x90