Wow wow wow. 1h30 to crack it, really ?
I’m just done (100%) with probably 8h in Java, so I’m feeling bad now
Were the rules and tests of the contest exactly the same as the single game we now have ?
Either my algo was good, and I was bad at implementing it, or my algo was bad.
I’m basically adding all “forced links” from the original state, and if the game is not solved after that, taking hypothesis as deep as needed to know if the hypothesis was good or bad (keeping in memory the state at each recursion).
Took me about 750 lines (lots of comments and quite verbose though).
No timeout and clean, but so far from 1h30 !
None of those, just crazy people being crazy fast, people like @SaiksyApo that redo every hard puzzle at his coffee break just to pass time.
Seriously though, I participate in this contest, and if you look at the results, you could see that it was really hard because not many people were able to finish in time. People that can really train or trained themselves with tons of exercices, lectures and such to achieve such level and speed.
You see, programming is experiment, fail, experiment, fail, then success. But those monsters have already experimented a lot, so when they see a new problem, when you and me are thinking “let’s try this, we’ll see if it’s work!”, they have already pinpoint a few solutions and choosing which one will be the fastest to implement.
TL;DR: git gud, practise and learn a lot, and maybe you or I will be able to become coding monsters ourselves
Hi guys … I can’t believe it …
I tried to submit my code … and it is failing on the last 3 tests (honestly I know that the last one my code is not able to produce a solution for the moment -> I have to think to a smarter solution) but I can’t understand the failure of the other two.
These are the links to see how my code tries to solve the problems:
and apparently I didn’t understand why the test cases are not passed.
Anyone of you is able to give me some explanation? Thanks
In the end, you must be able to go from any node to another.
I looked at your second replay, the element on the third row are not linked to others elements. So following the links you made, you cannot go from an element on the third row to an element on the second row.
I have a problem with the output that I do not manage to solve.
In the first test, I have an array which contains the 2 links :
0 2 0 0 1
0 2 2 2 1
So I do a loop to display all the array elements.
But it only print the first element, and display an error.
for(var r = 0; r < (retour.length); r++)
{
print(retour[r]);
}
Sortie standard :
0 2 0 0 1 Informations :
Missing node(s) in link: (0, 2) to (0, 0).
I hit weird problem which looks like a bug in interpreter.
In short - in the main data loop at some point script times out in reading next line of input.
It times out on test 5 but does not time out on last (and most complex) test case.
This looks like the environment was not feeding data to the script causing timeout. The way I looked at it was to print debug message before and after line = input() - for the last line of input second debug is missing (suggesting timeout on data input)
I don’t believe this times out due to time constraints for (a) complex test case gets loaded ok and (b) I don’t do much at this stage of the script
– Edit –
This also points to potential bug in Python3 interpreter - if I comment out all my code behind that data input loop all lines of input are fed correctly. If if remove comment last line of input is not being served. Commented code could not execute anyways since interpreter was timing out on input feed.
I spent sooooooooo many hours on this but I finally made it !
I’m pretty proud of it, because it wasn’t easy for me at all.
I have two distinct method: one for playing every 100% sure moves, one for simulate.
While game is not over:
I’m trying to play every forced link. I’m looping on every single node of the map.
Then, if there is still node with left links, I simulate a play. What took me a while is this part
So, my idea was to simulate two move per node: one to next right node (is existed) and one to next bottom node (if existing). After each play, I have a function checking if there isn’t one closed group of node (at first, I was waiting for the end of the game to check if the graph was complete, but it wasn’t efficient at all, we have to check this as soon as possible).
I’m still having fun with this problem. I’m at the point that I have to figure out the “multiple solution” ones I’m now getting multiple segments… [oh well].
I havent’ got a timeout issue yet, but I’m using a repetitive timer with a queue that issues the first solution after e.g. 950 ms and the next every 95 ms. Also I’m providing the answers by adding single links only (as to maximize the amount of time I’m allowed to spend calculating).
Hi,
just finished this cool problem.
The animation in the IDE seems to be buggy: in the last test (“expert”) some links on the last row and the last column don’t appear. Took me a while to understand the bug was not in my code
I figured it out. I actually decided to see if I could backtrack back from last node to first node using BFS. Other than that i did my heuristics first (4 in the corner, 8’s and 7’s) and then i backtracked for the rest. Not the fastest solution but it managed.
I have the same problem as you, I don’t understand why I hit timeout when the interpreter execute the last line of input. Anyone has managed to solve this problem in Python3 ?