My message could be misunderstandable, so I stress again: you can download the test inputs and their desired outputs after the round concluded. This is the input which is used for scoring the submissions. In general, you have to switch to the analysis tab and check the bottom part. Specifically for chain reaction, this is the direct link: https://codejam.googleapis.com/dashboard/get_file/AQj_6U25GFu1uaNa2Pa6zRBVp7EuesOobiqzkmwjnX9jjmiYkNNH6kbXQU-Ww8c1/test_data.zip?dl=1
Kata On Wed, Apr 6, 2022, 17:09 DarkDogg92 <[email protected]> wrote: > Hello there! > > The problem is I get a runtime error during the tests on site, thus no > hint is visible, even the testing samples are not known. I tried to > reproduce the error locally by making up some test cases but with no > success. > > środa, 6 kwietnia 2022 o 02:27:24 UTC+2 jawa napisał(a): > >> Hello plesse send one test case where it is failing >> >> https://codingcompetitions.withgoogle.com/codejam/round/0000000000876ff1/0000000000a45ef7 >> >> On Mon, 4 Apr 2022, 20:16 DarkDogg92, <[email protected]> wrote: >> >>> Hello everybody, >>> >>> I can't manage to solve the Chain Reactions problem. My solution seems >>> to work locally, passes the sample tests on site, but when it comes to the >>> real tests, I always get a runtime error. >>> >>> I decided to build a graph for every test case, then generate all the >>> permutations of the chain reaction initiators and traverse the graph in >>> order relevant for each permutation. >>> >>> I used a similar general code structure for other problems and it >>> worked, so I guess it is a problem with the solution's logic. >>> >>> Below is my code in JS. >>> Any suggestions would be greately appreciated! >>> >>> >>> >>> 'use strict'; >>> >>> var readline = require('readline'); >>> var rl = readline.createInterface({ >>> input: process.stdin, >>> output: process.stdout, >>> }); >>> >>> class NodeF { >>> constructor(f) { >>> this.back = false; >>> this.used = false; >>> this.f = f; >>> } >>> } >>> >>> class Input { >>> constructor(strings) { >>> this.stringsInd = 0; >>> this.strings = strings; >>> } >>> getString() { >>> return this.strings[this.stringsInd++]; >>> } >>> getStringArray(sep) { >>> return this.getString().split(sep); >>> } >>> getNumber() { >>> return parseInt(this.getString()); >>> } >>> getNumberArray(sep) { >>> return this.getStringArray(sep).map(a => parseInt(a)); >>> } >>> } >>> >>> let permutatorMethod = (inpArr) => { >>> let res = []; >>> let doPermute = (array, g) => { >>> if (array.length === 0) { >>> res.push(g); >>> } >>> else { >>> for (let x = 0; x < array.length; x++) { >>> let current = array.slice(); >>> let next = current.splice(x, 1); >>> doPermute(current.slice(), g.concat(next)); >>> } >>> } >>> }; >>> doPermute(inpArr, []); >>> return res; >>> }; >>> >>> let clearTree = (nodes) => { >>> nodes.forEach((node) => { >>> node.used = false; >>> }); >>> }; >>> >>> let solve = (input) => { >>> let n = input.getNumber(); >>> let fss = input.getNumberArray(' '); >>> let pss = input.getNumberArray(' '); >>> let nodes = []; >>> for (let i = 0; i < fss.length; i++) { >>> nodes.push(new NodeF(fss[i])); >>> } >>> for (let i = 0; i < pss.length; i++) { >>> if (pss[i] === 0) { >>> nodes[i].next = null; >>> } >>> else { >>> nodes[i].next = nodes[pss[i] - 1]; >>> nodes[pss[i] - 1].back = true; >>> } >>> } >>> let nodeInitiators = nodes.filter(x => x.back === false); >>> let nodeInitiatorsPerms = permutatorMethod(nodeInitiators); >>> let permsMaxes = []; >>> nodeInitiatorsPerms.forEach((perm) => { >>> clearTree(nodes); >>> let maxSum = 0; >>> perm.forEach((ni) => { >>> let max = 0; >>> while (ni !== null && ni.used !== true) { >>> max = Math.max(ni.f, max); >>> ni.used = true; >>> ni = ni.next; >>> } >>> maxSum += max; >>> }); >>> permsMaxes.push(maxSum); >>> }); >>> return Math.max(...permsMaxes); >>> }; >>> >>> >>> let main = (input) => { >>> let _numTests = input.getNumber(); >>> for (let _id = 1; _id <= _numTests; ++_id) { >>> console.log('Case #' + _id + ': ' + solve(input)); >>> } >>> }; >>> >>> function init() { >>> let strings = []; >>> rl.on('line', function (line) { >>> strings.push(line); >>> }).on('close', function () { >>> main(new Input(strings)); >>> process.exit(0); >>> }); >>> } >>> if (!module.parent) { >>> init(); >>> } >>> //# sourceMappingURL=index.js.map >>> >>> -- >>> -- You received this message because you are subscribed to the Google >>> Groups Code Jam group. To post to this group, send email to >>> [email protected]. To unsubscribe from this group, send email >>> to [email protected]. For more options, visit this group >>> at https://groups.google.com/d/forum/google-code?hl=en >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Google Code Jam" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/google-code/bbff8533-ad73-4b9d-8a72-6794831df987n%40googlegroups.com >>> <https://groups.google.com/d/msgid/google-code/bbff8533-ad73-4b9d-8a72-6794831df987n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > -- You received this message because you are subscribed to the Google > Groups Code Jam group. To post to this group, send email to > [email protected]. To unsubscribe from this group, send email > to [email protected]. For more options, visit this > group at https://groups.google.com/d/forum/google-code?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/7081bc5a-f35e-4965-b570-3b8b4d79ac5dn%40googlegroups.com > <https://groups.google.com/d/msgid/google-code/7081bc5a-f35e-4965-b570-3b8b4d79ac5dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- -- You received this message because you are subscribed to the Google Groups Code Jam group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at https://groups.google.com/d/forum/google-code?hl=en --- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/CAPOU4JNTrzx7o85587%3D6uO6x4-rnsxnY9FgPgv4ttmCR7D2mEw%40mail.gmail.com.
