ps | |
---|---|
링크 | acmicpc.net/… |
출처 | BOJ |
문제 번호 | 11000 |
문제명 | 강의실 배정 |
레벨 | 골드 5 |
분류 |
스위핑 |
시간복잡도 | O(nlogn) |
인풋사이즈 | n<=200000 |
사용한 언어 | Python |
제출기록 | 75868KB / 416ms |
최고기록 | 328ms |
해결날짜 | 2022/01/13 |
"""Solution code for "BOJ 11000. 강의실 배정".
- Problem link: https://www.acmicpc.net/problem/11000
- Solution link: http://www.teferi.net/ps/problems/boj/11000
Tags: [Sweeping]
"""
import sys
INF = float('inf')
END = 0
START = 1
def main():
N = int(sys.stdin.readline())
times = []
for _ in range(N):
S, T = [int(x) for x in sys.stdin.readline().split()]
times.append((S, START))
times.append((T, END))
lecture_count = 0
answer = max(
(lecture_count := lecture_count + (1 if event == START else -1))
for _, event in sorted(times))
print(answer)
if __name__ == '__main__':
main()