Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.025 s | 3 KBi |
#2 |
Incorrecto
|
0.03 s | 3 KBi |
#3 |
Correcto
|
0.023 s | 3 KBi |
#4 |
Correcto
|
0.025 s | 3 KBi |
#5 |
Incorrecto
|
0.021 s | 3 KBi |
#6 |
Incorrecto
|
0.609 s | 45 KBi |
#7 |
Correcto
|
0.521 s | 43 KBi |
#8 |
Correcto
|
0.572 s | 58 KBi |
#9 |
Tiempo límite excedido
|
1.043 s | 12 KBi |
#10 |
Tiempo límite excedido
|
1.034 s | 54 KBi |
def sol(arr , N): frontier = [] result = [] for idx in range(N-1, -1, -1): while(len(frontier) > 0 and arr[idx] >= frontier[0]): _ = frontier.pop(0) if len(frontier) == 0: cover = -1 else: cover = frontier[0] frontier.append(arr[idx]) result.append(cover) return result[::-1] num_cases = int(input()) for i in range(num_cases): N = int(input()) arr = [int(x) for x in input().split()] result = sol(arr, N) str_result = ' '.join([str(r) for r in result]) print(f"Case #{i+1}: {str_result}")