According to the Editoral
The answer is supposed to be
Let K be = Number of components such the number of edges == number of vertices then the answer is pow(2,k)
I used the same method but I calculated the number of cycles in each connected component. Le var be a variable. And if the cyclecount in a connected component is == 1 then I do var++ and later on the ans = pow(2,var)
I am getting 6 WA.
My Code
There is a possibility that my cycleCount function is wrong. If thats the case please do let me know!
Thank you!