I found the error. I was assuming that the input is just like shown in the statement: 1 line for number of nodes and 1 line for each node. It turns out this is not the case: the statement doesn't specify that, so each number could be in its own line, or there could be just 1 line with all the test cases.ebb wrote: ↑Sat Jun 10, 2017 11:37 pmHi everyone,
I'm having trouble with this problem. My code (Java) passes all the inputs in this thread and in uDebug, but gets Runtime Error in the judge. I'm pretty sure it is the code that reads the input, because when I wrap it in a try catch I get Wrong Answer. When I remove the actual algorithm instead, I keep getting RE. When catching the exception, it doesn't matter if I stop completely, simply go to the next test case or ignore the exception: I always get Wrong Answer.
Here's my code in case someone can give me a hint of what could be wrong. I've removed the algorithm so we can focus on the input-reading code.
Edit: I removed the code, as I found my mistake.
I've added examples to uDebug.
For solutions coded in C/C++ it shouldn't be a problem. For Java with Scanner it should be ok too, but if you use a Reader for better performance, you have to consider this kind of input.