Need help for 427C

Правка en3, от Ghost0fSparta, 2018-03-15 17:25:11

Hello CF, I have been recently trying to solve 427C. As per the editorial I have found all the strong connected components and then have found the minimum cost for each SCC component. Also I have found the number of junctions having the minimum value. But I am getting wrong answer for test case 71. My solution is here. I can't figure out my mistake can anybody help?

Let me jot down which function is doing what in my code
1) dfs_visit : Used for applying dfs on the graph provided and obtain the sequence of nodes according to their ending time which is stored in stack named seq.
2) scc_comp : Used to get the different SCCs for the reverse graph t_v which will be stored in scc.


The second issue is why are these two submissions giving different answers on Test case 71 Solution1 and Solution2.
Any optimization suggestions are also welcomed.
Thanks:)

Теги strongly connected, dfs and similar, graphs

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Ghost0fSparta 2018-03-15 17:25:11 6 Tiny change: '/36295240)\nAny opti' -> '/36295240). <br>\nAny opti'
en2 Английский Ghost0fSparta 2018-03-15 17:21:22 54
en1 Английский Ghost0fSparta 2018-03-15 17:20:02 1194 Initial revision (published)