CHEFCOMP - Editorial

For me, Obervation / Intuition worked, as I worked on some cases and was able to see it.
Actually, the subtask should help you to find out the observation / intution much quicker.

@harshil21 your logic is also same as of editorial??

Really loved your editorial!!!. Would be great if you guys could solve a test case by hand.

how can the subtask help to find the observation/intuition quicker?

https://www.codechef.com/viewsolution/37171143
I have implemented setters solution, but i can’t understand why i am getting wa

Just tell me the error , if instead of running the bfs and then clearing the source node vector and removing the source node from all other vectors in which it is present , I prefer to simply mark the source node as visited in my main after the bfs function so the next time the next source node goes through the bfs function it traverses only the nodes which are not visited ?

where’s the error ?

Just tell me the error , if instead of running the bfs and then clearing the source node vector and removing the source node from all other vectors in which it is present , I prefer to simply mark the source node as visited in my main after the bfs function so the next time the next source node goes through the bfs function it traverses only the nodes which are not visited ?

where’s the error ?

I using BFS and brute force approach for the first 30 points,but only two test cases are passing.
is my code wrong or only DFS can be applies here?