█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 4754

Problema 0xcf - Mirando al horizonte

  • Autor: Ikerlb
  • Fecha: 2021-08-13 05:42:10 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 16, in <module>
    print(_solve(arr))
  File "script.py", line 9, in _solve
    return " ".join(res)
TypeError: sequence item 0: expected str instance, int found
0.02 s 3 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 16, in <module>
    print(_solve(arr))
  File "script.py", line 9, in _solve
    return " ".join(res)
TypeError: sequence item 0: expected str instance, int found
0.027 s 3 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 16, in <module>
    print(_solve(arr))
  File "script.py", line 9, in _solve
    return " ".join(res)
TypeError: sequence item 0: expected str instance, int found
0.025 s 3 KBi
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 16, in <module>
    print(_solve(arr))
  File "script.py", line 9, in _solve
    return " ".join(res)
TypeError: sequence item 0: expected str instance, int found
0.022 s 3 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 16, in <module>
    print(_solve(arr))
  File "script.py", line 9, in _solve
    return " ".join(res)
TypeError: sequence item 0: expected str instance, int found
0.019 s 3 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 16, in <module>
    print(_solve(arr))
  File "script.py", line 9, in _solve
    return " ".join(res)
TypeError: sequence item 0: expected str instance, int found
0.389 s 38 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 16, in <module>
    print(_solve(arr))
  File "script.py", line 9, in _solve
    return " ".join(res)
TypeError: sequence item 0: expected str instance, int found
0.359 s 33 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 16, in <module>
    print(_solve(arr))
  File "script.py", line 9, in _solve
    return " ".join(res)
TypeError: sequence item 0: expected str instance, int found
0.456 s 71 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 16, in <module>
    print(_solve(arr))
  File "script.py", line 9, in _solve
    return " ".join(res)
TypeError: sequence item 0: expected str instance, int found
0.367 s 15 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 16, in <module>
    print(_solve(arr))
  File "script.py", line 9, in _solve
    return " ".join(res)
TypeError: sequence item 0: expected str instance, int found
0.398 s 55 KBi
Puntos totales: 0 / 100

Código

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 " ".join(res)

if __name__ == "__main__":
    c = int(input())
    for _ in range(c):
        N = int(input())
        arr = list(map(int, input().split(" ")))
        print(_solve(arr))