Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.047 s | 6 KBi |
#2 |
Incorrecto
|
0.066 s | 6 KBi |
#3 |
Incorrecto
|
0.056 s | 6 KBi |
#4 |
Incorrecto
|
0.052 s | 6 KBi |
#5 |
Incorrecto
|
0.057 s | 7 KBi |
#6 |
Correcto
|
0.05 s | 6 KBi |
#7 |
Correcto
|
0.049 s | 6 KBi |
#8 |
Correcto
|
0.048 s | 6 KBi |
#9 |
Incorrecto
|
0.055 s | 6 KBi |
#10 |
Incorrecto
|
0.056 s | 7 KBi |
#11 |
Correcto
|
0.039 s | 7 KBi |
#12 |
Correcto
|
0.05 s | 7 KBi |
const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); let sorted = true; rl.question('', (n) => { rl.question('', (numbersString) => { const numbers = numbersString.split(' ').map(number => Number(number)); let index = 0; while(index < n - 1 && !sorted) { sorted = numbers[index] <= numbers[index+1]; index++; } console.log(sorted ? 'Ordenado' : 'Desordenado'); rl.close(); }); });