Problem 44379. One track five lanes
why can't I use bwlabel from the imaging toolbox?
this one took a while to solve lol
No matter what you do you always fail the last test, it really ruins the problem.
Why is my solution (at size73) first when I sort low to high, though the leading solution is down at 43?
And really, more than 60 tests? It took me almost as long to copy and paste the the test cases as it did to solve the problem. I don't object to the number of tests, but can you please lump them, esp. as Submit just says "assertion failed" with no clue where the problem is?
@Daniel, this cheat does not work because user directories are effectively random (hint: you may simply use relative paths instead). In any way, this form of cheats/hacks are not welcome in this particular Cody problem. There are, nevertheless, plenty of hacking problems in Cody (e.g. https://www.mathworks.com/matlabcentral/cody/problems?term=tag%3Ahack) that welcome and even encourage this sort of explorations, so please use those venues instead if you are interested.
Somehow, this test suite has changed and now I cannot pass Test 62, even though I did not use a lookup table solution. Please advise.
The solution is timing out (it is just taking too long). I would recommend to change your code to use a single call to dijkstra_lanes instead of one separate call for each StartLane-to-EndLane combination. You may do so, for example, by adding two nodes to your graph, one "start" node that is connected (with distance 0) to every non-blocked lane in the first row, and one "end" node that is connected (with distance 0) to every non-blocked lane in the last row. Then you will only need to call dijkstra_lane once to compute the optimal path distance of this extended graph, instead of calling your function N1*N2 times (for each of the N1/N2 first/last -row non-blocked positions)
Thank you for the recommendation.
added a few more test cases to discourage look-up table solutions (by I liked your bin2dec idea to encode the board, I copied that in my testsuite now :)
sorry, Cody web interface has some issues with very long solution files (solutions cannot be viewed, html parsing is misinterpreted so other solutions listed below this one cannot be displayed, etc.), could you please resubmit a shorter file? I will then simply rescore this solution to force it to be cropped (which will also fix the formatting issues)
Problem Recent Solvers70
Project Euler: Problem 1, Multiples of 3 and 5
Numbers spiral diagonals (Part 1)
More from this Author38
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!