Pairing_graphs(cities)

please tell what is wrong in my approach.
only sample test case is passing.

question: https://ide.codingblocks.com/s/82867
code : https://ide.codingblocks.com/s/82866

if there are 5 componenet in a graph and each component have a b c d e no of cities
then ans =
ab+ac+ad+ae+bc+bd+b*e… and so on
just make a map of component and find all the component with there length now make 2 for loop for the ans

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.