Skip to content

Commit cae4918

Browse files
committed
[BOJ] 1931 회의실 배정 (G5)
1 parent a9fc31f commit cae4918

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

최어진/10주차/260306.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# 백준 1931번: 회의실 배정 (2회차)
2+
3+
import sys
4+
5+
input = sys.stdin.readline
6+
7+
# N <= 10^5
8+
N = int(input())
9+
meetings = [list(map(int, input().rstrip().split())) for _ in range(N)]
10+
meetings.sort(key=lambda x:(x[1], x[0]))
11+
12+
answer = 0
13+
last_end = -1
14+
15+
for start, end in meetings:
16+
if last_end <= start:
17+
# print(start, end)
18+
last_end = end
19+
answer += 1
20+
21+
print(answer)

0 commit comments

Comments
 (0)