Runguard: warning: timelimit exceeded (wall time): aborting command runguard: warning: command terminated with signal 15

#include<bits/stdc++.h>
#include
#include
using namespace std;

class Graph{
map<int,list > l;
public:

void addEdge(int x,int y){
    l[x].push_back(y);
}

int bfs(int src,int dest){
    map<int,int> dist;
    queue<int> q;

    for(auto node_pair:l){
        int node=node_pair.first;
		dist[node]=INT_MAX;
    }

    q.push(src);
    dist[src]=0;

    while(!q.empty()){
        int node=q.front();
        q.pop();
        
        for(int nbr: l[node]){
            if(dist[nbr]==INT_MAX){
                q.push(nbr);
                dist[nbr]=dist[node]+1;
            }
        }

    }

    // for(int node_pair:l){
    //     cout<<node_pair.first<<" and dist "<<dist[node_pair.first]<<endl;
    // }
    return dist[dest];
}

};

int main(){
int t;
cin>>t;
while(t–){
int size,l,s;
cin>>size>>l>>s;

    int board[size]={0};
    while(l--){
        int x,y;
        cin>>x>>y;
        board[x]=y-x;
    }
    while(s--){
        int x,y;
        cin>>x>>y;
        board[x]=y-x;
    }
    
    Graph g;
    int j,i;
    for(i=0;i<size;i++){
        for(int dice=1;dice<=6;dice++){
            j=i+dice;
            j+=board[j];
        }
        if(j<size){
            g.addEdge(i,j);
        }
    }
    g.addEdge(size,size);

    cout<<g.bfs(0,size)<<endl;
    
}
return 0;

}

Save your code on ide.codingblocks.com and then share its link.

plzz check this…i have changed only the input taking part in main…else code was of snake ladder video.
but is is showing error

Give the input and then check your code. It is not giving TLE error but it is giving wrong answer.
So your logic is wrong somewhere.
Refer this https://ide.codingblocks.com/s/288799
Each step has been explained in detail

sir …the code is same as explained in video then how can logic be incorrect…i m changing the way of taking input.plz check my code .the one u gave ,i understand that but the approach is different.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.