Help me out in this spoj problem i am segmentation fault it is based on simple bipartite kindly read the question


question link:https://www.spoj.com/problems/BUGLIFE/

call me on 8368547890…

just minute changes in ur code.
#include<bits/stdc++.h>

using namespace std;

bool checkpartite(vector v[],int n)

{

vector<int> vis(n+10,-1);

vector<int> color(n+10,-1);

int source;

int i,j;



for( i=1;i<=n;i++)

{

    if(vis[i]==-1)

    {

        source=i;

        queue<int> q;

        q.push(source);

        vis[source]=1;

        color[source]=1;

        while(!q.empty())

        {

            int f=q.front();

            q.pop();

            for( j=0;j<v[f].size();j++)

            {

                int child=v[f][j];

                if(vis[child]==-1)

                {

                    color[child]=1-color[f];

                    vis[child]=1;

                    q.push(child);

                }

                else if(color[child]==color[f])

                {

                    return false;

                }

            }

        }

    }

}

return true;

}

int main()

{

int t;

cin>>t;

int cnt=1;

while(t–)

{

    int n,e;

    int x,y;

    cin >>n>>e; // Number of vertices and edges

     vector<int> v[n+1];

     for(int i=1;i<=e;i++)

     {

        cin>>x>>y;

        v[x].push_back(y);

        v[y].push_back(x);

     }

    bool ans=checkpartite(v,n);

    cout<<"Scenario #"<<cnt<<":"<<endl;

    if(ans)

    {

    

        cout<<"No suspicious bugs found!"<<endl;

     }

    else

    {

    

        cout<<"Suspicious bugs found!"<<endl;

    }

      cnt++;

}

}
resolve the dout thanks.

What is the issue?? Please elaborate your doubt.