Hey,
My code was passing all the test cases but was failing a tunnel validator too.
when you check the animation for tunnel validator I could see that it was not printing the data for the lowest level points.
I assumed that,like in all other puzzles, if the height is H then the lowest point will be either 0 either H-1. But here it is actually H as it turned out.
so if youre using a for(;;){} loop, then consider checking you actually cover all the area
I usually code in C++. This kinda looks like python, but python doesnāt do i++. I think I can still read the code even though Iām not sure what language this is.
I traced through searchNextD. the First return was c.x =1 c.y =0;
My second time going through:
while (1 <= 2 or grid[0,1] is ā0ā) //go into because 1<=2 also [0,1] is ā0ā either
if (1 == 2-1) //break out of while loop
if (grid[0,1] != ā0ā) //grid[0,1] does == ā0ā so we wonāt change x or y to -1
return c.x = 1 c.y = 0
So we started with x=0 y=0
After first pass x=1 y=0
After second pass x=1 y=0
After Third pass x=1 y=0
ā¦
Your X and Y will never update because X wonāt increment.
Iām not a superstar at coding, do you think I figured it out or did I get it wrong?
Hi everyone, I am a bit confused here. Since nobody seems to ask this so I feel dumb asking this. I am having difficulty in understanding the coordinates in the example. They are [[0, 0],[1, 0],[0, 1],[1, 1]], for me it doesnāt make sense. If we follow i,j loop pattern then the coordinates should be [[0, 0], [0, 1], [1, 0], [1, 1]] and if we follow x,y pattern then the coordinates should be [[0, 1], [1, 1], [0, 0], [1, 0]]. Can anyone help clearing out my confusion? Am I the only one dumb here thinking that way? If so no problem Iāll learn from it and be lesser dumb next time
Your question is perfectly legitimate, and you arenāt dumb at all to ask it! The statement merely provides an example to show how the coordinate system works in this puzzle without explicitly explaining it⦠The coordinate system is usually explained in the statement for most puzzles, but alas, this puzzle isnāt doing that.
In most (but not all) puzzles on CodinGame, y-coordinates increase downwards instead of upwards while x-coordinates increase when you move to the right.
Thanks a lot @5DN1L for the clarification. Just because of the lack of explanation regarding the coordinates in this puzzle, it took me a lot more than it should. For me, this puzzle is simple and Iād have done it in 5mins max, but just because of this confusion it took me a lot of debugging in understanding the coordinates.
same here I think this platform doesnāt support basic C++ features. try your code on difference code editor mine works fine on any other editor. itās the site problem
Iām confused by this problem. I had a solution that should work, but after running the first double loop and printing out my answer, I get an error saying only one node was calculated. I updated my answer to just store all answers and was going to print them all out at the end, but then I get an error indicating no result provided in time.
Does this question expect an output for each node as soon as itās calculated (x1 y1 x2 y2 x3 y3)? Or does it expect all things calculated first then print out at the end?
Regardless, I am clearly doing something wrong with my loops and/or print statement.
Can you give us an example by stating which case youāve failed, and copy and paste here what you see in the console (everything, including your output)?
Iām not able to upload an image yet because Iām still a new user I guess. This is the best I can do for the console output.
Game information: [0/2]
Initializing APU weaponry...
Standard Error Stream: [1/2]
width = 2
height = 2
input = 00
Node[0,0] is 0
The next line: 0.
0 0 1 0 0 1 <<<this is console.error.writeline()
Standard Output Stream:
0 0 1 0 0 1 <<<this is console.writeline()
Game information: [2/2]
Timeout: Only 1 node has been computed.
No worries, I was expecting some text instead of an image anyway
The console output you provided is for the first test (āExampleā), right? Youāre expected to print three lines as the answer for that case:
0 0 1 0 0 1
1 0 -1 -1 -1 -1
0 1 -1 -1 -1 -1
It looks like your code is unable to come up with the second and third lines and/or print them out correctly. You may check whether thatās indeed the case, and revise your code accordingly.
Unfortunately, that doesnāt really help much. The best I can deduce is that after running the first calculation, the next time through the loop is taking too long before it would print out.
I have tried going through all nodes and adding them to an array then printing, but the program says I failed to calculate any nodes in time.
I have tried collecting just the first output (0 0 1 0 0 1) and printing that before the next loop starts, but the program says only 1 node was calculated because of a time out.
I read over the whole problem again and it says āFirst response must occur within 1 second, additional responses within 100msā. I am at a complete loss as to how to speed up my execution time though.