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

Envío 5104

Problema 0x9d - ¿Está ordenado?

  • Autor: jarangolp
  • Fecha: 2021-10-15 04:10:42 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:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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.048 s 7 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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 9 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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.056 s 7 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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.048 s 7 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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.063 s 14 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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.039 s 7 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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.064 s 7 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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.046 s 6 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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.062 s 11 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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.064 s 7 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 1
/box/script.js:14
      if (numbers[i] > numbers[i+1]) {
                  ^

ReferenceError: i is not defined
    at /box/script.js:14:19
    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.057 s 17 KBi
Puntos totales: 0 / 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[i] > numbers[i+1]) {
        sorted = false;
        break;
      }
      i++;
    }
    console.log(sorted ? 'Ordenado' : 'Desordenado');
    rl.close();
  });
});