Pliz give inputs for which wrong

@sgdon142
If i am not wrong, here your answer is just counting the number of connected components.

Here you are missing the nore written in problem statement : - “Drawing a line which is already drawn, doubles the width of line and thus it can be added to specifications, i.e. if a line is drawn again, it is treated as a distinct line in the specifications”
For understanding this, take an example of an tree like structure of graph.
For eg:- the edges are (1,2) (1,3), (1,4) here it is a connected component, but here you will have to traverse atleast one edge 2 times.

So here you will have to use the concept of euler path. If you don’t know about it, don’t worry just do google about it and have a look at this video https://www.youtube.com/watch?v=8MpoO2zA2l4&t=592s

So you just have to check for every connected component that is it a euler path or not. If not then take the count of vertices which have odd degrees. Then just figure out the number of ways to connect the total count of odd degree vertices.

pliz tell the inputs for which it is wrong

@sgdon142
Draw and see for this.
3
1 1 2 1
3 3 4 4
5 5 6 6

in else should be print cout<<(odd_deg-1)/2;

Also you need to find the number of connected components because for eg you have 2 connected components and for them all the vertices are even degree then your answer will be zero, but here your answer is 1, because you need to atleast connected both the components.

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.