getting segmentation fault
ide: https://ide.codingblocks.com/s/242443
Beautiful Graph - Codeforces
Hello @Vishal123, just a small mistake is there
if(visited[node]){
if(1+parity != visited[node]){
odd_cycle = 0;
return;
}
}
This code you have written if the node is visited and parity is same, but if the parity is diff you didn’t take any action and it can go into infinite loop.
so add else return;
if(visited[node]){
if(1+parity != visited[node]){
odd_cycle = 0;
return;
}
else return;
}
Pls make this change it will work fine.
I hope it is clear to you. In case it is clear to you pls mark it as resolve and provide the rating as well as feedback so that we can improve ourselves.
In case there is still some confusion pls let me know, I will surely try to help you out.
Thanks 
Happy Coding !!