Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.04 s | 7 KBi |
#2 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.034 s | 7 KBi |
#3 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.099 s | 13 KBi |
#4 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.04 s | 7 KBi |
#5 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.042 s | 7 KBi |
#6 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.034 s | 7 KBi |
#7 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.031 s | 7 KBi |
#8 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.065 s | 9 KBi |
#9 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.077 s | 10 KBi |
#10 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.077 s | 10 KBi |
#11 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.042 s | 10 KBi |
#12 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.052 s | 10 KBi |
#13 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.041 s | 10 KBi |
#14 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 /box/script.js:15 currentSum = item + currentSum; ^ ReferenceError: item is not defined at sumSubTotals (/box/script.js:15:4) at Interface.<anonymous> (/box/script.js:32:20) at Interface.emit (events.js:210:5) at Interface._onLine (readline.js:316:10) 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) |
0.054 s | 10 KBi |
const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); let lineCounter = 0; let subTotalsArray; function sumSubTotals(initialArray) { let currentSum = 0 let sumsArray = [] for(let i = 0; i < initialArray.length; i++) { currentSum = item + currentSum; sumsArray.push(currentSum); } return sumsArray } const sumSubArray = (fromIndex, toIndex) => { if (fromIndex === 0) return subTotalsArray[toIndex] return subTotalsArray[toIndex] - subTotalsArray[fromIndex - 1]; } rl.on("line", (line) => { ++lineCounter; if (lineCounter === 2) { // Run the initial algorithm const initialArray = line.split(" ").map(Number); subTotalsArray = sumSubTotals(initialArray) } if (lineCounter > 3) { // these are the inputs Q & P const [Q, P] = line.split(" ").map(Number); console.log(sumSubArray(Q, P)) } })