Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.054 s | 12 KBi |
#2 |
Correcto
|
0.053 s | 8 KBi |
#3 |
Correcto
|
0.06 s | 7 KBi |
#4 |
Correcto
|
0.036 s | 8 KBi |
#5 |
Correcto
|
0.054 s | 7 KBi |
#6 |
Correcto
|
0.056 s | 10 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.762 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.374 s | 125 KBi |
#9 |
Tiempo límite excedido
|
0.778 s | 116 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.389 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.522 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.616 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.285 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.353 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.296 s | 125 KBi |
#16 |
Correcto
|
0.198 s | 61 KBi |
#17 |
Correcto
|
0.401 s | 61 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.32 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.445 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.394 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.516 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.363 s | 125 KBi |
#23 |
Tiempo límite excedido
|
0.217 s | 15 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.544 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.512 s | 125 KBi |
#26 |
Tiempo límite excedido
|
0.675 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.488 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 pivot = Number(arr[arr.length - 1]); const lessThanArr = []; const greaterThanArr = []; arr .slice(0, arr.length - 1) .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(); }