Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.057 s | 7 KBi |
#2 |
Incorrecto
|
0.054 s | 7 KBi |
#3 |
Incorrecto
|
0.059 s | 7 KBi |
#4 |
Incorrecto
|
0.04 s | 6 KBi |
#5 |
Incorrecto
|
0.038 s | 7 KBi |
#6 |
Incorrecto
|
0.033 s | 7 KBi |
#7 |
Incorrecto
|
0.045 s | 7 KBi |
#8 |
Incorrecto
|
0.047 s | 7 KBi |
#9 |
Incorrecto
|
0.064 s | 7 KBi |
#10 |
Incorrecto
|
0.039 s | 7 KBi |
#11 |
Incorrecto
|
0.091 s | 32 KBi |
#12 |
Incorrecto
|
0.058 s | 7 KBi |
#13 |
Incorrecto
|
0.036 s | 7 KBi |
#14 |
Incorrecto
|
0.052 s | 8 KBi |
#15 |
Incorrecto
|
0.04 s | 8 KBi |
#16 |
Incorrecto
|
0.036 s | 7 KBi |
#17 |
Incorrecto
|
0.062 s | 7 KBi |
#18 |
Incorrecto
|
0.034 s | 7 KBi |
#19 |
Incorrecto
|
0.069 s | 8 KBi |
#20 |
Incorrecto
|
0.05 s | 8 KBi |
const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }) const input = []; rl.on('line', line => input.push(...line.split('').map(Number)) ) 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) { const str = '' arr.forEach(el => str = str + ' ' + el); } const sorted = quicksort(input); console.log(arrToString(sorted));