Getting test cases wronng https://ide.codingblocks.com/s/188691

https://ide.codingblocks.com/s/188691

@Faizan-Ali-1395131367301898 Its incorrect because the way you are calculating total ways is wrong.
Lets say you have three components with x1,x2 and x3 elements respectively . Then you are calculating the answer to be x1 * x2 * x3 whereas it should be x1 * x2+x1 * x3+x2 * x3, just basic P&C.

https://ide.codingblocks.com/s/188703 updated code but only one test case running

How are you solving for isolated vertices? Your code gives ans to be 0 for input
5 0
whereas it should be 15

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.