I need help debugging

Revision en2, by brdy, 2018-07-16 18:56:38

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.

The problem: http://www.usaco.org/index.php?page=viewproblem2&cpid=230

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.

Tags help, pls, frien, bitset


  Rev. Lang. By When Δ Comment
en2 English brdy 2018-07-16 18:56:38 2 Tiny change: 's wrong:\n1) Stack' -> 's wrong:\n\n1) Stack'
en1 English brdy 2018-07-16 18:55:57 1102 Initial revision (published)