Mr. Xifu and His New School

After working as a teacher for a long time, Mr. Xifu has finally decided to open a new school of his…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

Input:
5
2
23:00 05:00
04:00 10:00
Output:
Case #1: Mr.Xifu needs 2 classroom(s)

Here the 1st class starts at 23:00 (11:00 pm) and ends on the next day (not the current day) at 5:00 (5:00 pm). And the 2nd class starts at 4:00 (4:00 am) and ends at 10:00 (10:00 am). So, why here need 2 classrooms in a day?

05:00 is 5:00am, not 5:00 pm

First day:
Room1: class 1=> 04:00 to 10:00 (finished)
Class 2=> 23:00 to continues

Second day:
Room1: class 2=> first day 23:00 to second day 05:00
Room2: class 1=> 04:00 to 10:00 (as room1 is busy till 5 am,
and second class start at 4 am)