Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.011 s | 3 KBi |
#2 |
Correcto
|
0.008 s | 3 KBi |
#3 |
Correcto
|
0.011 s | 3 KBi |
#4 |
Correcto
|
0.008 s | 3 KBi |
#5 |
Correcto
|
0.008 s | 3 KBi |
#6 |
Correcto
|
0.008 s | 3 KBi |
#7 |
Correcto
|
0.008 s | 3 KBi |
#8 |
Correcto
|
0.012 s | 3 KBi |
#9 |
Correcto
|
0.012 s | 3 KBi |
#10 |
Correcto
|
0.011 s | 3 KBi |
#11 |
Correcto
|
0.012 s | 3 KBi |
#12 |
Correcto
|
0.01 s | 3 KBi |
#13 |
Correcto
|
0.009 s | 3 KBi |
#14 |
Correcto
|
0.014 s | 3 KBi |
#15 |
Correcto
|
0.009 s | 3 KBi |
#16 |
Correcto
|
0.015 s | 3 KBi |
#17 |
Correcto
|
0.012 s | 3 KBi |
#18 |
Correcto
|
0.009 s | 3 KBi |
#19 |
Correcto
|
0.009 s | 3 KBi |
def maxima_area_valla(alturas): n = len(alturas) max_area = 0 for i in range(n): min_height = alturas[i] for j in range(i, n): min_height = min(min_height, alturas[j]) width = j - i + 1 area = min_height * width max_area = max(max_area, area) return max_area def main(): # Leer el número de edificios (Read the number of buildings) n = int(input()) # Leer las alturas de los edificios (Read the heights of the buildings) alturas = list(map(int, input().split())) # Calcular la máxima área posible para la valla (Calculate the maximum possible area for the fence) max_area = maxima_area_valla(alturas) # Imprimir el resultado (Print the result) print(max_area) if __name__ == "__main__": main()