Problem Link: Chor Tintin Tikri
Statement
My approach
Note: Actually the problem contain wrong statement .Here 0<=Edge<=5000 .
Input:
4 6
1 2
1 3
1 4
2 3
2 4
3 4
__1__
_/ | \_
_/ | \_
_/ ___3__ \_
_/ _/ \_ \
2 ___/___________\___4
In this graph , every vertices is a part of some triangles. And Adjacent of nodes(1,2 4) make a cycle of odd length and thus the output will be 4.
And got many wrong answer using this approach. Can anyone suggest any hint please or solution ? Thanks in Advance.
My implementation
Your solution is right. This problem contains wrong statement about the constraints . Here the number of edges can be 0. Consider this constraint.
Thanks.