complete 1463, 1931, 2156, 11053

This commit is contained in:
2021-02-22 02:13:36 +09:00
parent 02e2f2717d
commit a225d7c91e
5 changed files with 58 additions and 32 deletions

View File

@@ -0,0 +1,13 @@
N = int(input())
I = [tuple(map(int, input().split())) for _ in range(N)]
I.sort(key=lambda x: (x[1], x[0]))
last = 0
cnt = 0
for i in range(N):
if last <= I[i][0]:
last = I[i][1]
cnt += 1
print(cnt)