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

Envío 5443

Problema 0x4f - Rectángulo de máxima área dentro de un histograma pequeño

  • Autor: bryancalisto
  • Fecha: 2021-12-16 22:11:06 UTC (Hace casi 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.036 s 6 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.022 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.026 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.027 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.02 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.03 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.008 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.026 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.008 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.025 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.016 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.026 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.023 s 4 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.007 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 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.008 s 3 KBi
#16
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.024 s 3 KBi
#17
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.025 s 3 KBi
#18
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.009 s 3 KBi
#19
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 4, in <module>
    for i, edif in enumerate(edifs):
NameError: name 'edifs' is not defined
0.007 s 3 KBi
Puntos totales: 0 / 100

Código

area = 0
past = [(-1, -1)]

for i, edif in enumerate(edifs):
    area = max(area, edif)
    while past and past[-1][1] > edif:
        _i, _edif = past.pop()
        area = max(area, edif*(i - past[-1][0]))
    past.append((i, edif))

print(area)