█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 4776

Problema 0x7b - Mínimo número de salones para acomodar todas las clases

  • Autor: Ikerlb
  • Fecha: 2021-08-13 22:36:25 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.028 s 3 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.023 s 3 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.025 s 3 KBi
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.021 s 3 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.026 s 3 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.024 s 3 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.023 s 3 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.021 s 3 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.02 s 3 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.023 s 3 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.026 s 3 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.027 s 3 KBi
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.021 s 3 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.02 s 3 KBi
#15
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 20, in <module>
    N = int(input())^I^I
NameError: name 'I' is not defined
0.03 s 3 KBi
Puntos totales: 0 / 100

Código

from heapq import heappush, heappop
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())^I^I
    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))