Logo
(追記) (追記ここまで)

34395번 - Office Hours 2 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB128866.667%

문제

It's the start of a very busy semester, and your professor wants to determine when to schedule office hours so that they can be attended by as many students as possible. They have schedules for every student, but there are a lot of students! Can you write an algorithm to determine which two hours in the week will maximize the number of students who can attend at least one office hour?

입력

The first line is an integer 2ドル \leq N \leq 10,000円,ドル the number of lines that specify the student schedules.

The following $N$ lines specify the availability of a single student on a single day. Each line contains a series of space-separated fields. The first field consists of between 1ドル$ and 10ドル$ alphabetical characters, specifying the student's name. The second field is the day of the week for which the student is reporting availability (e.g. "Monday"), including weekends. The third field is an integer 1ドル \leq P \leq 24,ドル the number of unique, non-overlapping time ranges for which the student has reported availability. The final $P$ fields on the line are time ranges, in the format x-y, where $x < y$ and $x$ and $y$ are both integers between 0ドル$ and 24ドル,ドル inclusive, specifying the hour that marks the beginning and end of their availability, respectively.

Note that the combination of student name and day is unique. That is, a student will not report their availability for the same day on multiple lines.

Note also that the input will be such that there is a unique combination of two hours for which the maximum number of students are available.

출력

Two lines specifying the two days and times that maximize the number of students that can attend at least one office hour. The first line should represent a time occurring earlier in the week than the second line, assuming that Sunday at hour 0ドル$ represents the beginning of the week.

제한

예제 입력 1

3
Emily Monday 2 9-13 14-15
John Monday 1 12-14
Sarah Monday 1 15-16

예제 출력 1

Monday 12
Monday 15

예제 입력 2

7
Juan Tuesday 2 1-7 15-17
Juan Thursday 3 8-10 12-14 16-18
Hannah Monday 2 9-12 14-17
Bob Monday 1 12-14
Bob Thursday 2 5-6 14-17
Darnell Monday 1 16-24
Katy Sunday 1 12-13

예제 출력 2

Monday 16
Thursday 16

노트

출처

School > CS@Mines > CS@Mines HSPC 2022 > Advanced G번

  • 문제를 만든 사람: Colin Siles
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /