Hide

Problem H
Office Hours

/problems/mines22.officehours/file/statement/en/img-0001.jpg
Your professor is wondering when to schedule their office hours for the upcoming semester. Since every student has a different schedule, the professor needs to find the best time to host office hours.

Your task is to output the time and day of the week that your professor should host office hours given the availability of the students. Your professor can host one hour of office hours per week, so you must find the time at which the largest number of students are available to attend office hours.

For simplicity, $24$-hour time will be used (there is no AM/PM). Each day starts at midnight which is denoted as 00:00. The last hour of the day starts at 23:00 (11:00 PM).

Input

The first line of input will be an integer $1 \leq N \leq 10\, 000$, the number of availability reports that follow. The next $N$ lines will contain each person’s name, a day they have availability, an integer $1 \leq X \leq 24$ indicating how many hours they are available on that day, and $X$ integers indicating the hours in $24$-hour time when they are available that day, each separated by a space.

An integer $H$ denoting when a student has availability means that they are available from H:00 until (H+1):00. All integers $H$ representing times will be in the range $[0, 23]$.

Note that a student’s name may appear on more than one line if they have availability on more than one day of the week. Names are guaranteed to have no spaces.

Output

A string with the best day ($D$) and time ($T$) for office hours:

    Your professor should host office hours D @ T

where $D$ is one of “Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, or “Saturday” (without the quotes) and $T$ is a zero-padded time representing the start of the office hours in $24$-hour time. (If the time is before 10:00, then there should be a leading $0$ as in 01:00.)

Note that the solution is guaranteed to be unique. That is, there is a single day and time for which the maximum number of students are available to attend office hours.

Sample Input 1 Sample Output 1
6
Ethan Monday 2 10 14
Ethan Tuesday 1 5
Sumner Monday 2 10 17
Sumner Friday 1 2
Colin Tuesday 1 15
Colin Friday 1 3
Your professor should host office hours Monday @ 10:00
Sample Input 2 Sample Output 2
1
Mariana Monday 1 7
Your professor should host office hours Monday @ 07:00

Please log in to submit a solution to this problem

Log in