Yes, instead of saying I need "help with problem" or "help with algorithm" where instead I just want you to help debug, I will be straight with you.
I need help debugging.
I have tried debugging for 3 weeks, but no progress.
My Solution (10/11 cases): https://pastebin.com/4kdzmf4F
My solution's idea is basically same as editorial's: convert graph to tsp problem and do tsp like bitmask dp.
But now on RxC = 50x50 and N = 15 case it gets MLE/RTE.
My ideas for what's wrong:
1) Stack exceeded because too deep recursion -- > it's probably not this because I change recursive dp to iterative deepening but it still don't work. (loop decreasing order and call solve())
2) Segfault in dp table -- > I cannot find how it will segfault, I stored 2^16 values for 0...15 element bitmask. 15'th element is ghost island I made so you can start at any other island.
3) Some other memory error -- > I am not experienced enough to find out!
Help me this has been bugging me for so long.