Cyber Opening Ceremony
InterviewTime limit1sMemory limit1024 MB
Given start, end, and stream-end times plus chat logs, count members who chatted at or before the start and again between the end and stream-end.
- Level
Medium4 of 10
- Topics
- Hash map, Implementation, Sorting, String
- Solved
- No attempts yet
Problem
Boyoung runs the algorithm club HI-ARC.
Boyoung and the club officers worked hard to prepare a welcome for the freshmen entering in 2020, but as the epidemic worsened, the government declared "social distancing," and the school notified all clubs on campus to refrain from offline meetings. Even in this difficult situation with the recommendation to avoid offline gatherings, Boyoung used her wits and decided to replace the opening ceremony with a Mytube stream.
However, holding the opening ceremony as a Mytube stream came with the following problems.
- There is no way to know who came to the opening ceremony.
- There is no way to know who stayed until the end of the opening ceremony.
- There is no way to know who merely left the opening ceremony stream running.
To solve these problems, she decided to manage the attendance list as follows.
- Before the opening ceremony begins, check whether each member's entry is confirmed. A member's entry is checked by looking at the nicknames of members who have chatted before the time the opening ceremony started. A member who leaves a chat message at the very moment the opening ceremony starts is also considered to have had their entry confirmed on time.
- After the opening ceremony ends and until the stream ends, check whether each member's exit is confirmed. A member's exit is checked by looking at the nicknames of members who have chatted between the end of the opening ceremony and the end of the stream. A member who leaves a chat message at the very moment the opening ceremony ends, or at the very moment the opening ceremony stream ends, is also considered to have had their exit confirmed on time.
From 00:00 onward is the waiting time before the opening ceremony starts, and chat records left after the time the opening ceremony stream ended are considered chat records of a different streamed video.
How many members have both their entry and exit confirmed?
Input
The first line gives the time the opening ceremony started S, the time the opening ceremony ended E, and the time the opening ceremony stream ended Q. (00:00 ≤ S < E < Q ≤ 23:59)
Each time is given in the format HH:MM.
From the second line onward, the chat records of the streamed video broadcast by HI-ARC are given in chronological order, each in the form (time) (member nickname). A member's nickname is a string consisting only of uppercase and lowercase letters, digits, and the special symbols (., _, -), with a maximum length of 20 characters.
All chat records occurred on the day the opening ceremony took place. That is, only times from 00:00 to 23:59 are given. There are no more than 100,000 chat records.
Output
Output the number of members whose attendance is confirmed.
Hint
The description of the problem differs from the facts.