Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.073 s | 7 KBi |
#2 |
Correcto
|
0.033 s | 7 KBi |
#3 |
Correcto
|
0.049 s | 7 KBi |
#4 |
Correcto
|
0.034 s | 7 KBi |
#5 |
Correcto
|
0.055 s | 7 KBi |
#6 |
Correcto
|
0.035 s | 7 KBi |
#7 |
Correcto
|
0.072 s | 7 KBi |
#8 |
Correcto
|
0.04 s | 7 KBi |
#9 |
Correcto
|
0.071 s | 7 KBi |
#10 |
Correcto
|
0.062 s | 7 KBi |
#11 |
Correcto
|
0.034 s | 7 KBi |
#12 |
Correcto
|
0.066 s | 7 KBi |
const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const EventEmitter = require("events"); const emitter = new EventEmitter(); function getNumbers(n) { rl.once("line", function (line) { const parts = line.split(" ").slice(0, n); const inAscOrder = (arr) => arr.join("") === arr.sort((a, b) => a - b).join(""); const estado = inAscOrder(parts) ? "Ordenado" : "Desordenado"; console.log(estado); rl.close(); }); } rl.once("line", (line) => { const numberOfEntries = line.split(" ").slice(0, 1)[0]; const numberOfEntriesInt = parseInt(numberOfEntries, 10); emitter.emit("getNumbers", numberOfEntriesInt); }); emitter.on("getNumbers", getNumbers);