Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.02 s | 3 KBi |
#2 |
Incorrecto
|
0.028 s | 3 KBi |
#3 |
Correcto
|
0.022 s | 3 KBi |
#4 |
Correcto
|
0.021 s | 3 KBi |
#5 |
Incorrecto
|
0.026 s | 3 KBi |
#6 |
Incorrecto
|
0.635 s | 46 KBi |
#7 |
Correcto
|
0.544 s | 43 KBi |
#8 |
Correcto
|
0.677 s | 57 KBi |
#9 |
Tiempo límite excedido
|
1.039 s | 27 KBi |
#10 |
Tiempo límite excedido
|
1.008 s | 58 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(str(cover)) return result[::-1] num_cases = int(input()) str_results = [] for i in range(num_cases): N = int(input()) arr = [int(x) for x in input().split()] result = sol(arr, N) str_result = ' '.join(result) str_results.append(str_result) for i , str_result in enumerate(str_results): print(f"Case #{i+1}: {str_result}")