Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.101 s | 32 KBi |
#2 |
Correcto
|
0.041 s | 7 KBi |
#3 |
Correcto
|
0.058 s | 7 KBi |
#4 |
Correcto
|
0.053 s | 7 KBi |
#5 |
Correcto
|
0.074 s | 32 KBi |
#6 |
Correcto
|
0.087 s | 31 KBi |
#7 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.491 s | 125 KBi |
#8 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.312 s | 125 KBi |
#9 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.421 s | 125 KBi |
#10 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.401 s | 125 KBi |
#11 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.529 s | 125 KBi |
#12 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.423 s | 125 KBi |
#13 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.538 s | 125 KBi |
#14 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.395 s | 125 KBi |
#15 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.483 s | 125 KBi |
#16 |
Correcto
|
0.342 s | 61 KBi |
#17 |
Correcto
|
0.385 s | 66 KBi |
#18 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.479 s | 125 KBi |
#19 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.494 s | 125 KBi |
#20 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.525 s | 125 KBi |
#21 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.498 s | 125 KBi |
#22 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.412 s | 125 KBi |
#23 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.435 s | 125 KBi |
#24 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.488 s | 125 KBi |
#25 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.456 s | 125 KBi |
#26 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.404 s | 125 KBi |
#27 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/node-12.14.0/bin/node script.js |
0.536 s | 125 KBi |
const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); let lineCount = 0 rl.on("line", (line) => { ++lineCount if (lineCount === 2) { const initial = line.split(" "); const sorted = quicksort(initial); console.log(arrToString(sorted)); } }); function quicksort(arr) { if (arr.length <= 1) { return arr; } const copyArr = [...arr]; const pivot = Number(copyArr.pop()); const lessThanArr = []; const greaterThanArr = []; copyArr .forEach((el) => { const num = Number(el); return num < pivot ? lessThanArr.push(num) : greaterThanArr.push(num)} ); return [...quicksort(lessThanArr), pivot, ...quicksort(greaterThanArr)]; } function arrToString(arr) { let str = ""; arr.forEach((el) => (str = str + " " + el)); return str.trim(); }