Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.022 s | 3 KBi |
#2 |
Correcto
|
0.03 s | 3 KBi |
#3 |
Correcto
|
0.021 s | 3 KBi |
#4 |
Correcto
|
0.022 s | 3 KBi |
#5 |
Correcto
|
0.02 s | 3 KBi |
#6 |
Correcto
|
0.023 s | 3 KBi |
#7 |
Correcto
|
0.021 s | 3 KBi |
#8 |
Correcto
|
0.023 s | 3 KBi |
#9 |
Correcto
|
0.021 s | 3 KBi |
#10 |
Correcto
|
0.02 s | 3 KBi |
#11 |
Correcto
|
0.023 s | 3 KBi |
#12 |
Correcto
|
0.026 s | 3 KBi |
#13 |
Correcto
|
0.761 s | 16 KBi |
#14 |
Correcto
|
0.325 s | 9 KBi |
#15 |
Correcto
|
0.783 s | 16 KBi |
from heapq import heappush, heappop, heappushpop def rooms(times): times.sort() h = [] res = 0 for s, e in times: res = max(res, len(h)) while h and h[0] <= s: heappop(h) heappush(h, e) return max(res, len(h)) def hour_to_mins(s): h, m = s.split(":") return 60 * int(h) + int(m) if __name__ == "__main__": N = int(input()) times = [] for _ in range(N): sh, eh = input().split(" ") s = hour_to_mins(sh) e = hour_to_mins(eh) times.append((s, e)) print(rooms(times))