Religious People Problem Only 1 test case is passed. Tell me the mistake

Algorithm:
i am making connected components
then cost of building temple is less then simply build a temple in each node
else

eg. if( a component has 5 nodes => 1 of them has a temple made rest 4 will incur cost of road repair)
for no of independ component build 1 temple in each component
in the edgesInConnectedComponent vector i am storing the no of nodes each connected component has
so multiply the cost of road repair with no of nodes in each connected component

refer the code to get a better understanding

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.