█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 5105

Problema 0x9d - ¿Está ordenado?

  • Autor: jarangolp
  • Fecha: 2021-10-15 04:11:01 UTC (Hace alrededor de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:18
      i++;
      ^

ReferenceError: i is not defined
    at /box/script.js:18:7
    at Interface._onLine (readline.js:314:5)
    at Interface._normalWrite (readline.js:461:12)
    at ReadStream.ondata (readline.js:172:10)
    at ReadStream.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at ReadStream.Readable.push (_stream_readable.js:224:10)
    at internal/fs/streams.js:191:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)
0.052 s 6 KBi
#2
Correcto
0.054 s 6 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:18
      i++;
      ^

ReferenceError: i is not defined
    at /box/script.js:18:7
    at Interface._onLine (readline.js:314:5)
    at Interface._normalWrite (readline.js:461:12)
    at ReadStream.ondata (readline.js:172:10)
    at ReadStream.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at ReadStream.Readable.push (_stream_readable.js:224:10)
    at internal/fs/streams.js:191:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)
0.052 s 7 KBi
#4
Correcto
0.05 s 6 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:18
      i++;
      ^

ReferenceError: i is not defined
    at /box/script.js:18:7
    at Interface._onLine (readline.js:314:5)
    at Interface._normalWrite (readline.js:461:12)
    at ReadStream.ondata (readline.js:172:10)
    at ReadStream.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at ReadStream.Readable.push (_stream_readable.js:224:10)
    at internal/fs/streams.js:191:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)
0.05 s 7 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:18
      i++;
      ^

ReferenceError: i is not defined
    at /box/script.js:18:7
    at Interface._onLine (readline.js:314:5)
    at Interface._normalWrite (readline.js:461:12)
    at ReadStream.ondata (readline.js:172:10)
    at ReadStream.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at ReadStream.Readable.push (_stream_readable.js:224:10)
    at internal/fs/streams.js:191:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)
0.055 s 7 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:18
      i++;
      ^

ReferenceError: i is not defined
    at /box/script.js:18:7
    at Interface._onLine (readline.js:314:5)
    at Interface._normalWrite (readline.js:461:12)
    at ReadStream.ondata (readline.js:172:10)
    at ReadStream.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at ReadStream.Readable.push (_stream_readable.js:224:10)
    at internal/fs/streams.js:191:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)
0.055 s 7 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:18
      i++;
      ^

ReferenceError: i is not defined
    at /box/script.js:18:7
    at Interface._onLine (readline.js:314:5)
    at Interface._normalWrite (readline.js:461:12)
    at ReadStream.ondata (readline.js:172:10)
    at ReadStream.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at ReadStream.Readable.push (_stream_readable.js:224:10)
    at internal/fs/streams.js:191:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)
0.065 s 6 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:18
      i++;
      ^

ReferenceError: i is not defined
    at /box/script.js:18:7
    at Interface._onLine (readline.js:314:5)
    at Interface._normalWrite (readline.js:461:12)
    at ReadStream.ondata (readline.js:172:10)
    at ReadStream.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at ReadStream.Readable.push (_stream_readable.js:224:10)
    at internal/fs/streams.js:191:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)
0.049 s 6 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:18
      i++;
      ^

ReferenceError: i is not defined
    at /box/script.js:18:7
    at Interface._onLine (readline.js:314:5)
    at Interface._normalWrite (readline.js:461:12)
    at ReadStream.ondata (readline.js:172:10)
    at ReadStream.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at ReadStream.Readable.push (_stream_readable.js:224:10)
    at internal/fs/streams.js:191:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)
0.05 s 6 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:18
      i++;
      ^

ReferenceError: i is not defined
    at /box/script.js:18:7
    at Interface._onLine (readline.js:314:5)
    at Interface._normalWrite (readline.js:461:12)
    at ReadStream.ondata (readline.js:172:10)
    at ReadStream.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at ReadStream.Readable.push (_stream_readable.js:224:10)
    at internal/fs/streams.js:191:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)
0.059 s 7 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:18
      i++;
      ^

ReferenceError: i is not defined
    at /box/script.js:18:7
    at Interface._onLine (readline.js:314:5)
    at Interface._normalWrite (readline.js:461:12)
    at ReadStream.ondata (readline.js:172:10)
    at ReadStream.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at ReadStream.Readable.push (_stream_readable.js:224:10)
    at internal/fs/streams.js:191:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)
0.05 s 7 KBi
Puntos totales: 17 / 100

Código

const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let sorted = true;
rl.question('', (n) => {
  rl.question('', (numbersString) => {
    const numbers = numbersString.split(' ').map(number => Number(number));
    let index = 0;
    while(index < n - 1) {
      if (numbers[index] > numbers[index+1]) {
        sorted = false;
        break;
      }
      i++;
    }
    console.log(sorted ? 'Ordenado' : 'Desordenado');
    rl.close();
  });
});