wa in galactik football

getting WA constantly.here my code http://www.codechef.com/viewsolution/3265861

hey guys help me…:frowning:

somebody plzzzzzzzzzzzzz…help kar de…:frowning:

Your codes are giving wrong answer for
5 3
1 2
2 3
4 5
-1
-1
-1
1
1
correct answer is -1 but your answer is 2.

for(int i=1;i<=n;i++)
    {dfs(i);}
    for(int i=1;i<=n;i++)
    {co[i]=mi;visited[i]=0;}

I think this is wrong. mi will be 1 and it will assign all co[i] to 1 thats why your answer is 2.