int n;cin>>n;
vector<string> bfs;
vector<int> visited;
vector<vector<int>> adj(n,vector<int>(n,0));
int range=n-1;
for (int i=0;i<range;i++){
cout<<"hi"<<"\n";
int a,b;cin>>a>>b;
cout<<"hi";
adj[a-1][b-1]=1;
cout<<"hi";
adj[b-1][a-1]=1;
cout<<"hi";
}
This is my code, for some reason I get a segfault on the very last input?
Aucun commentaire:
Enregistrer un commentaire