Doubt in today's ABC 226 Problem E

Revision en1, by 51stDimension, 2021-11-07 18:44:25

Problem Link

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!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English 51stDimension 2021-11-07 18:44:25 1765 Initial revision (published)