Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.056 s | 7 KBi |
#2 |
Correcto
|
0.06 s | 7 KBi |
#3 |
Correcto
|
0.043 s | 6 KBi |
#4 |
Correcto
|
0.065 s | 7 KBi |
#5 |
Correcto
|
0.05 s | 7 KBi |
#6 |
Correcto
|
0.112 s | 7 KBi |
#7 |
Correcto
|
0.062 s | 6 KBi |
#8 |
Correcto
|
0.064 s | 7 KBi |
#9 |
Correcto
|
0.045 s | 6 KBi |
#10 |
Correcto
|
0.044 s | 6 KBi |
#11 |
Correcto
|
0.055 s | 7 KBi |
#12 |
Correcto
|
0.064 s | 7 KBi |
var readline = require('readline'); var rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); function lineCounter(line = 0) { return ++line } function isSorted(arr) { let sorted = true for (let i = 1; i < arr.length; i++) { if (arr[i] < arr[i - 1]) { sorted = false; break; } } return sorted } rl.on("line", function(line, lineNum = lineCounter()) { var parts = line.split(" ").map(Number); if (parts.length > 1) { console.log( isSorted(parts) ? "Ordenado" : "Desordenado" ) } });