Closed Ra1nWarden closed 9 years ago
TLE is due to the initialization of adjacency matrix. Choosing an adjacency seems to solve the time issue. However, I got a RE now instead. It might due to stack overflow as the recursive call to tarjan() gets way too deep. It is possible to make this iterative but I am not going to do that. Marked as fixed now.
11770 got AC with the same code so my guess is correct.
Reduce the graph into a DAG with SCC. Then this problem becomes Minimum Cover Path (which seems to be related to maximum bipartite matching.) I will revisit this later when I finish later chapters.