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:
First find all the vertices in the ring using
dfs()
.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. :)