Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.023 s | 3 KBi |
#2 |
Correcto
|
0.025 s | 3 KBi |
#3 |
Correcto
|
0.022 s | 3 KBi |
#4 |
Correcto
|
0.019 s | 3 KBi |
#5 |
Correcto
|
0.024 s | 3 KBi |
#6 |
Correcto
|
0.734 s | 51 KBi |
#7 |
Correcto
|
0.526 s | 36 KBi |
#8 |
Correcto
|
0.567 s | 52 KBi |
#9 |
Correcto
|
0.787 s | 46 KBi |
#10 |
Correcto
|
0.736 s | 60 KBi |
cases = int(input()) + 1 for c in range(1, cases): n = int(input()) a = list(map(int, input().split(" "))) # Se hacen saltos entre los edificios mas altos para reducir las # iteraciones. cache = [0] * n for i in range(n - 1, -1, -1): cache[i] = i + 1 while cache[i] < n and a[i] >= a[cache[i]]: cache[i] = cache[cache[i]] output = " ".join( ["-1" if cache[i] >= n else str(a[cache[i]]) for i in range(0, n)] ) print(f"Case #{c}: {output}")