SnowflakeOA #31
Meeting Assistant
估计中等可在线判题
Each event has the format person action start end, and the occupied start and end minutes are both inclusive. Within 00:00..23:59, find the earliest k consecutive minutes during which everyone who appears in the events is free. Return −1 if there is no solution; the meeting must not cross into the next day.
输入格式
The first line contains n k, followed by n lines of events; times use the HH:MM format. 1≤n≤100000, 1≤k≤1440, each original event string has length ≤40, the number of people is <5000, and events of the same person do not overlap.
输出格式
Output the earliest time HH:MM, or −1 if it is impossible.
样例 1
输入:
3 60
Alex busy 00:00 08:00
Sam busy 07:00 13:00
Alex busy 12:30 13:59
输出:
14:00
样例 2
输入:
2 1
sam busy 12:00 23:59
alex busy 00:00 13:00
输出:
-1
样例 3
输入:
2 60
sam busy 12:00 18:59
alex busy 00:00 11:00
输出:
19:00
样例说明
The answers to the three public examples are, in order: 14:00; -1; 19:00. The examples were rechecked by independent enumeration, state search, or direct simulation.