Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.03 s | 4 KBi |
#2 |
Incorrecto
|
0.032 s | 3 KBi |
#3 |
Correcto
|
0.03 s | 3 KBi |
#4 |
Correcto
|
0.026 s | 3 KBi |
#5 |
Incorrecto
|
0.021 s | 3 KBi |
#6 |
Incorrecto
|
0.425 s | 43 KBi |
#7 |
Correcto
|
0.334 s | 42 KBi |
#8 |
Correcto
|
0.437 s | 57 KBi |
#9 |
Incorrecto
|
0.356 s | 46 KBi |
#10 |
Incorrecto
|
0.341 s | 58 KBi |
from collections import deque def looking_to_the_horizon(array, n): stack = deque(maxlen=n) stack.append(-1) tallest_building = array[n - 1] for i in reversed(range(n - 1)): current_building_height = array[i] if current_building_height >= tallest_building: stack.append(-1) tallest_building = current_building_height else: stack.append(tallest_building) return list(reversed(stack)) number_of_cases = int(input()) for i in range(number_of_cases): array_size = int(input()) array = [int(x) for x in input().split()] print("Case #{0}: {1}".format(i + 1, ' '.join(map(str, looking_to_the_horizon(array, array_size)))))