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

Envío 1297

Problema 0xdd - Ordenar un arreglo pequeño

  • Autor: abatesins
  • Fecha: 2020-10-19 13:22:02 UTC (Hace alrededor de 4 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 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.024 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 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.018 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 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.029 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 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.025 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 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.023 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 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.029 s 3 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.024 s 3 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.03 s 3 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.022 s 3 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.017 s 3 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.031 s 3 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.029 s 3 KBi
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.03 s 3 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.021 s 3 KBi
#15
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.021 s 3 KBi
#16
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.02 s 3 KBi
#17
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.019 s 3 KBi
#18
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.028 s 3 KBi
#19
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.023 s 3 KBi
#20
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    arr = list(map(int, [input() for _ in range(num_elements)]))
  File "script.py", line 10, in <listcomp>
    arr = list(map(int, [input() for _ in range(num_elements)]))
EOFError: EOF when reading a line
0.022 s 3 KBi
Puntos totales: 0 / 100

Código

def bubblesort(arr, num_elements):
  for i in range(num_elements-1):
    for ii in range(0, num_elements - i - 1):
      if (x0 := arr[ii]) > (x1 := arr[ii+1]):
        arr[ii:ii+2] = x1, x0
  return arr

if __name__ == "__main__":
  num_elements = int(input())
  arr = list(map(int, [input() for _ in range(num_elements)]))
  
  sorted_arr = bubblesort(arr, num_elements)
  print(' '.join(map(str, sorted_arr)))