Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.058 s | 7 KBi |
#2 |
Correcto
|
0.061 s | 7 KBi |
#3 |
Correcto
|
0.073 s | 7 KBi |
#4 |
Correcto
|
0.042 s | 6 KBi |
#5 |
Correcto
|
0.054 s | 7 KBi |
#6 |
Correcto
|
0.069 s | 7 KBi |
#7 |
Correcto
|
0.044 s | 7 KBi |
#8 |
Correcto
|
0.061 s | 7 KBi |
#9 |
Correcto
|
0.063 s | 6 KBi |
#10 |
Correcto
|
0.058 s | 7 KBi |
#11 |
Correcto
|
0.065 s | 7 KBi |
#12 |
Correcto
|
0.06 s | 7 KBi |
let readline = require("readline"); let lineNumber = 0; let listLengthInput; let listVerify = []; process.stdin.setEncoding("utf8"); let stdin = readline.createInterface({ input: process.stdin, terminal: false, }); stdin.on("line", readLine); function readLine(line) { if (lineNumber == 0) { if (!isNaN(parseInt(line))) { listLengthInput = parseInt(line); lineNumber++; } else { console.log("Invalid Input"); } } else { let numbersList = line.split(" "); if (listLengthInput === numbersList.length && listLengthInput > 1) { for (let index = 0; index < listLengthInput - 1; index++) { let num = Number(numbersList[index]); let numi = Number(numbersList[index + 1]); listVerify.push(num > numi); } if (listVerify.some((bool) => bool === true)) { console.log("Desordenado"); } else { console.log("Ordenado"); } } else { console.log("Ordenado"); } } }