Can someone please help tell me why I am getting WA for 131D - Subway 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(cycle) using
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
This algorithm is the same as mentioned in the editorial
Seeking some help. Thank you. :)