complete 1326.py and 11000.py

This commit is contained in:
2024-05-18 08:41:05 +09:00
parent 3487bfc0ab
commit ea757baead
2 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import sys
import heapq
input = sys.stdin.readline
def solve(N, Cl):
Cl.sort()
pq = []
heapq.heappush(pq, Cl[0][1])
for i in range(1, N):
if pq[0] <= Cl[i][0]:
heapq.heappop(pq)
heapq.heappush(pq, Cl[i][1])
return len(pq)
if __name__ == "__main__":
N = int(input())
Cl = [tuple(map(int, input().split())) for _ in range(N)]
print(solve(N, Cl))