I was trying to solve [this problem.](http://mo.mff.cuni.cz/cpspc/2010/2-sailor-plen.pdf)↵
↵
I could only figure out the naive solution. (DFS from each vertex) I think I have encountered similar problems before but I couldn't solve them either. How do I solve this kind of problem?
↵
I could only figure out the naive solution. (DFS from each vertex) I think I have encountered similar problems before but I couldn't solve them either. How do I solve this kind of problem?