Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.061 s | 10 KBi |
#2 |
Incorrecto
|
0.052 s | 7 KBi |
#3 |
Incorrecto
|
0.061 s | 16 KBi |
#4 |
Incorrecto
|
0.066 s | 7 KBi |
#5 |
Incorrecto
|
0.047 s | 12 KBi |
#6 |
Incorrecto
|
0.05 s | 7 KBi |
#7 |
Incorrecto
|
0.064 s | 14 KBi |
#8 |
Incorrecto
|
0.04 s | 6 KBi |
#9 |
Incorrecto
|
0.059 s | 19 KBi |
#10 |
Incorrecto
|
0.07 s | 14 KBi |
#11 |
Incorrecto
|
0.057 s | 12 KBi |
#12 |
Incorrecto
|
0.036 s | 6 KBi |
let firstLine = ""; let secondLine = ""; async function validateIsOrderList(listLengthInput, numbersList) { if (listLengthInput === numbersList.length) { let listVerify = []; for (let index = 0; index < listLengthInput - 1; index++) { let num = numbersList[index]; let numi = numbersList[index + 1]; listVerify.push(num < numi); } if (listVerify.some((bool) => bool === false)) { return false; } else { return true; } } } process.stdin.on("data", async (line) => { if (!firstLine) { firstLine = line.toString(); } else if (!secondLine) { secondLine = line.toString().trim(); } if (firstLine && secondLine) { let listLengthInput = Number(firstLine); let numbersList = secondLine.split(/\s+/); const isOrder = await validateIsOrderList(listLengthInput, numbersList); if (isOrder) { console.log("Ordenado"); } else { console.log("Desordenado"); } } });