Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.027 s | 3 KBi |
#2 |
Correcto
|
0.024 s | 4 KBi |
#3 |
Correcto
|
0.03 s | 5 KBi |
#4 |
Correcto
|
0.028 s | 4 KBi |
#5 |
Correcto
|
0.026 s | 3 KBi |
#6 |
Correcto
|
0.582 s | 38 KBi |
#7 |
Correcto
|
0.5 s | 19 KBi |
#8 |
Correcto
|
0.455 s | 53 KBi |
#9 |
Correcto
|
0.56 s | 12 KBi |
#10 |
Correcto
|
0.682 s | 54 KBi |
def sol(arr , N): output = "" result = [None] * N for idx in range(N-1, -1, -1): result[idx] = idx + 1 while(result[idx] < N and arr[idx] >= arr[result[idx]]): result[idx] = result[result[idx]] for idx in range(N): if (result[idx] >= N): output += " -1" else: output += " " + str(arr[result[idx]]) return output num_cases = int(input()) for i in range(num_cases): N = int(input()) arr = [int(x) for x in input().split()] str_result = sol(arr, N) print(f"Case #{i+1}:{str_result}")