Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.051 s | 7 KBi |
#2 |
Incorrecto
|
0.052 s | 7 KBi |
#3 |
Incorrecto
|
0.057 s | 7 KBi |
#4 |
Incorrecto
|
0.054 s | 7 KBi |
#5 |
Incorrecto
|
0.049 s | 7 KBi |
#6 |
Incorrecto
|
0.047 s | 6 KBi |
#7 |
Incorrecto
|
0.06 s | 7 KBi |
#8 |
Incorrecto
|
0.057 s | 7 KBi |
#9 |
Incorrecto
|
0.063 s | 7 KBi |
#10 |
Incorrecto
|
0.06 s | 7 KBi |
#11 |
Incorrecto
|
0.062 s | 7 KBi |
#12 |
Incorrecto
|
0.055 s | 8 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); console.log(num > numi, num, numi); } if (listVerify.some((bool) => bool === true)) { console.log("Desordenado"); } else { console.log("Ordenado"); } } else { console.log("Ordenado"); } } }