Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.021 s | 3 KBi |
#2 |
Incorrecto
|
0.027 s | 3 KBi |
#3 |
Incorrecto
|
0.02 s | 3 KBi |
#4 |
Incorrecto
|
0.023 s | 3 KBi |
#5 |
Incorrecto
|
0.022 s | 3 KBi |
#6 |
Incorrecto
|
0.56 s | 41 KBi |
#7 |
Incorrecto
|
0.485 s | 49 KBi |
#8 |
Incorrecto
|
0.368 s | 72 KBi |
#9 |
Incorrecto
|
0.69 s | 43 KBi |
#10 |
Incorrecto
|
0.727 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] = str(n) s.append((n, i)) return " ".join(res) if __name__ == "__main__": c = int(input()) for _ in range(c): N = int(input()) arr = list(map(int, input().split(" "))) print(_solve(arr))