Giving wrong answer for one test case

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

class Graph {
map<int, list> mp;
public:
Graph() {

}

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

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

	for (auto i : mp) {
		dist[i.first] = INT_MAX;
	}

	queue<int> q;
	q.push(src);
	dist[src] = 0;

	while (!q.empty()) {
		int front = q.front();
		q.pop();

		for (auto nbr : mp[front]) {
			if (dist[nbr] == INT_MAX) {
				dist[nbr] = 1 + dist[front];
				q.push(nbr);
			}
		}
	}
	if (dist[dest] != INT_MAX)
		cout << dist[dest] << endl;
	else {
		cout << "-1" << endl;
	}
}

};

int main() {

// #ifndef ONLINE_JUDGE
// freopen(“input.txt”, “r”, stdin);
// freopen(“output.txt”, “w”, stdout);
// #endif

int t;
cin >> t;

while (t--) {

	Graph g;

	int n;
	cin >> n;

	int board[101] = {0};

	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;

		board[x] = y - x;
	}

	int m;
	cin >> m;

	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;

		board[x] = y - x;
	}

	for (int i = 1; i <= 100; i++) {
		for (int dice = 1; dice <= 6; dice++) {
			int j = dice + i;
			j += board[j];

			if (j <= 100) {
				g.addEdge(i, j);
			}
		}
	}
	g.addEdge(100, 100);
	g.bfs(1, 100);
}

}

@alter
There are few mistakes in your code

  1. The graph should be unidirectional i.e line no. 13 ( mp[y].push_back(x); ) is not required.
  2. condition in line 32 should be if (dist[nbr] > (1 + dist[front] ))
    Here is the updated code: https://ide.codingblocks.com/s/249450

@alter
Please mark this doubt as resolved.

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.