/bin/run.sh: line 4: 19 Segmentation fault (core dumped) ./exe
gettting this error
#include
#include<bits/stdc++.h>
using namespace std;
int bfs(vectoradj[],int s , int d)
{
int dis[110]={INT_MAX};
dis[s]=0;
queue<int>q;
q.push(s);
while(!q.empty())
{
int temp=q.front();
q.pop();
for(auto it:adj[temp])
{
if(dis[it]==INT_MAX)
{
q.push(it);
dis[it]=dis[temp]+1;
}
}//end for
}//end while
return dis[d];
}
int main() {
int n;
cin>>n;
while(nā)
{
int l;
cin>>l;
int board[110]={0};
int x;
int y;
for(int i=0;i<l;i++)
{
cin>>x>>y;
board[x]=y-x;
}
int s;
cin>>s;
int a,b;
for(int i=0;i<s;i++)
{
cin>>a>>b;
board[a]=-1*(a-b);
}
vector<int>adj[101];
for(int i=0;i<=100;i++)
{
for(int dice=1;dice<=6;dice++)
{
int j=i+dice;
j+=board[j];
if(j<=100)
{
adj[i].push_back(j);
}
}//2nd
}//1st
adj[100].push_back(100);
cout<<bfs(adj,0,100)<<endl;
}//while end
return 0;
}