Classroom assignment
InterviewTime limit1sMemory limit256 MB
Given N class time intervals, find the smallest number of rooms so overlapping classes never share a room.
Problem
You are given the timetable of classes. Class starts at time and ends at time . Find the smallest number of classrooms that lets every class run.
One classroom holds at most one class at any moment. The next class may start at the exact time the previous one ends, so if , then class and class can share a classroom.
Input
The first line contains the number of classes . ()
Each of the next lines contains and , separated by a space. ()
Output
Print the minimum number of classrooms needed to run every class.