Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.022 s | 3 KBi |
#2 |
Correcto
|
0.021 s | 3 KBi |
#3 |
Correcto
|
0.028 s | 3 KBi |
#4 |
Correcto
|
0.021 s | 3 KBi |
#5 |
Correcto
|
0.031 s | 3 KBi |
#6 |
Correcto
|
0.474 s | 43 KBi |
#7 |
Correcto
|
0.578 s | 42 KBi |
#8 |
Correcto
|
0.604 s | 71 KBi |
#9 |
Correcto
|
0.503 s | 46 KBi |
#10 |
Correcto
|
0.622 s | 58 KBi |
def _solve(arr): res = [-1] * len(arr) s = [] for i, n in enumerate(arr): while s and s[-1][0] < n: _, j = s.pop() res[j] = n s.append((n, i)) return res if __name__ == "__main__": c = int(input()) for i in range(1, c + 1): N = int(input()) arr = list(map(int, input().split(" "))) print(f"Case #{i}: {' '.join(map(str, _solve(arr)))}")