Skip to content

Commit 1acdaf1

Browse files
committed
πŸ‘‘ G5-1374
1 parent 898b369 commit 1acdaf1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

β€ŽπŸ‘‘ G5/1374.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import sys
2+
from heapq import *
3+
input = sys.stdin.readline
4+
5+
n = int(input())
6+
lecture = [list(map(int, input().split())) for _ in range(n)]
7+
lecture.sort(key=lambda x: (x[1], x[2]))
8+
lectureroom = [lecture[0][2]]
9+
heapify(lectureroom)
10+
11+
for i in range(1, n):
12+
if lecture[i][1] >= lectureroom[0]:
13+
heappop(lectureroom)
14+
heappush(lectureroom, lecture[i][2])
15+
16+
print(len(lectureroom))

0 commit comments

Comments
 (0)