Problem link: http://www.spoj.com/problems/BUGLIFE/
My solution:
Using bfs: http://ideone.com/IKJO4U
Using dfs: http://ideone.com/F9NXIe
Its a bipartite graph problem. I am using two numbers to color the nodes 1 and -1.
Getting WA,please let me know where I am doing it wrong.
Thanks!