Deep CV
[백준] - 1931 파이썬 python 본문
· 풀이
끝나는 시간, 시작 하는 시간 기준으로 정렬 후, 시간 하는 시간이 전의 끝나는 시간 이후면 count.
arr = []
n = int(input())
for i in range(n):
arr.append(list(map(int,input().split())))
arr.sort(key=lambda x:(x[1],x[0]))
count = 0
pre_end = 0
for start, end in arr:
if start >= pre_end:
pre_end = end
count += 1
print(count)
'Python > 백준(BOJ) 알고리즘' 카테고리의 다른 글
[백준] - 1946파이썬 python (0) | 2021.07.14 |
---|---|
[백준] - 13305 파이썬 python (0) | 2021.07.11 |
[백준] - 1541파이썬 python (0) | 2021.07.11 |
[백준] - 11399 파이썬 python (0) | 2021.07.11 |
[백준] - 11047 파이썬 python (0) | 2021.07.11 |