Anyone is there please help me out

#include<bits/stdc++.h>
using namespace std;
int n;
bool bipartite(vector *g)
{
int color[n];
int v[n];
for(int i=0;i<n;i++)
{
color[i]=-1;
v[i]=-1;
}
for(int i=0;i<n;i++)
{
if(v[i]==-1)
{
queue q;
q.push(i);
v[i]=1;
color[i]=1;
while(!q.empty())
{
int f=q.front();
q.pop();
for(int i=0;i<g[f].size();i++)
{
if(g[f][i]!=-1)
{
color[i]=1-color[f];
q.push(i);
v[i]=1;
}
else
{
if(color[i]==color[f])
{
return false;
}
}
}
}
}
}
return true;

}

int main()
{

cin>>n;
vector<int> v[n];
int x,y;
for(int i=0;i<n;i++)
{
	
	cin>>x>>y;
	v[x].push_back(y);
}

bool ans =bipartite(v);
cout<<ans;

}

hi anyone is there …

Please save your code on ide.codingblocks.com and then share its link.
Also mention the problem you are facing


kindly tell me the error bipartite graph problem

i have send the link
no output is comming
runguard: warning: timelimit exceeded (wall time): aborting command
runguard: warning: command terminated with signal 15
this error is coming

are u there @pratyush63

Check the nested loops in line 15 and line 27… You have take both the loop variables as i. This must be causing the problem.
Your code is giving such error as it may be leading to an infinite loop somewhere