[Graphs] WA for problem 131D

Revision en1, by calmhandtitan, 2015-06-27 22:28:04

Can someone please help tell me why I am getting WA for 131D - Метро or where my code goes wrong.

I get WA at test8 which is a very big test having 3000 nodes for which I am unable to debug.

Here's my submission. 11783845

My intended algorithm is as follows:

  1. First find all the vertices in the ring using dfs().

  2. Then do DFS for each of the vertex in the ring to find the distance of each node from the ring. This is done by dfs2()

This algorithm is the same as mentioned in the editorial

Seeking some help. Thank you. :)

Tags graphs, dfs

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English calmhandtitan 2015-06-27 22:29:17 7 Tiny change: 'n the ring using `df' -> 'n the ring(cycle) using `df'
en1 English calmhandtitan 2015-06-27 22:28:04 645 Initial revision (published)