Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.053 s | 7 KBi |
#2 |
Correcto
|
0.036 s | 7 KBi |
#3 |
Correcto
|
0.033 s | 7 KBi |
#4 |
Correcto
|
0.035 s | 7 KBi |
#5 |
Correcto
|
0.047 s | 7 KBi |
#6 |
Correcto
|
0.068 s | 7 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.39 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.68 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.764 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.438 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.337 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.329 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.455 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.34 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.463 s | 125 KBi |
#16 |
Correcto
|
0.262 s | 68 KBi |
#17 |
Correcto
|
0.35 s | 64 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.445 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.271 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.551 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.274 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.695 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.34 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.478 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.64 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.448 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.372 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(" ").map(Number); const sorted = quicksort(initial); console.log(arrToString(sorted)); } }); function quicksort(arr) { if (arr.length <= 1) { return arr; } const pivot = arr[arr.length - 1]; const lessThanArr = []; const greaterThanArr = []; arr .slice(0, arr.length - 1) .forEach((el) => el < pivot ? lessThanArr.push(el) : greaterThanArr.push(el) ); return [...quicksort(lessThanArr), pivot, ...quicksort(greaterThanArr)]; } function arrToString(arr) { let str = ""; arr.forEach((el) => (str = str + " " + el)); return str.trim(); }