n = int(input())
time = sorted([tuple(map(int, input().split()))
for _ in range(n)], key=lambda x: (x[1], x[0])) #x[1]이 중요
ans = end = 0
for s, e in time:
if s >= end:
ans += 1
end = e
print(ans)
'개발 > Algorithm' 카테고리의 다른 글
[Python] 백준 1541번 잃어버린 괄호 (0) | 2021.11.09 |
---|---|
[Python] 백준 11399번 ATM (0) | 2021.11.09 |
[Python] 백준 2798번 블랙잭 (0) | 2021.11.08 |
[Python] 백준 10870번 피보나치 수열 (0) | 2021.11.08 |
[Python] 백준 10872번 팩토리얼 (0) | 2021.11.08 |
댓글