Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.069 s | 9 KBi |
#2 |
Correcto
|
0.04 s | 7 KBi |
#3 |
Correcto
|
0.055 s | 11 KBi |
#4 |
Correcto
|
0.068 s | 14 KBi |
#5 |
Correcto
|
0.061 s | 15 KBi |
#6 |
Correcto
|
0.073 s | 16 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.598 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.893 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.667 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.6 s | 125 KBi |
#11 |
Tiempo límite excedido
|
1.037 s | 117 KBi |
#12 |
Tiempo límite excedido
|
1.112 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.645 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.668 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.537 s | 125 KBi |
#16 |
Correcto
|
0.54 s | 68 KBi |
#17 |
Correcto
|
0.479 s | 63 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.525 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.568 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.612 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.654 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.57 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.677 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.518 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 |
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.941 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.668 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 = []; for (let i = 0; i < copyArr.length; i++) { Number(copyArr[i]) < pivot ? lessThanArr.push(copyArr[i]) : greaterThanArr.push(copyArr[i]) } return [...quicksort(lessThanArr), pivot, ...quicksort(greaterThanArr)]; } function arrToString(arr) { let str = ""; for (let i = 0; i < arr.length; i++) { str = str + " " + arr[i] } return str.trim(); }