Dijkstra's algorithm C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> countOfPairs(int n, int x, int y) {\n        x--;\n        y--;\n        vector<vector<pair<int, int>>> graph(n);\n        for (int i = 0; i < n; i++) {\n            if (i > 0) {\n                graph[i].push_back({i - 1, 1});\n                graph[i - 1].push_back({i, 1});\n            }\n        }\n        graph[x].push_back({y, 1});\n        graph[y].push_back({x, 1});\n\n        vector<int> result(n, 0);\n\n        for (int src = 0; src < n; src++) {\n            vector<int> dist(n, INT_MAX);\n            dist[src] = 0;\n            priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;\n            pq.push({0, src});\n            while (!pq.empty()) {\n                int d = pq.top().first;\n                int u = pq.top().second;\n                pq.pop();\n\n                if (d > dist[u]) continue;\n\n                for (auto& edge : graph[u]) {\n                    int v = edge.first;\n                    int weight = edge.second;\n                    if (dist[u] + weight < dist[v]) {\n                        dist[v] = dist[u] + weight;\n                        pq.push({dist[v], v});\n                    }\n                }\n            }\n\n            for (int i = 0; i < n; i++) {\n                if (i != src && dist[i] <= n) {\n                    result[dist[i] - 1] += 1;\n                }\n            }\n        }\n\n        return result;\n    }\n};\n```
['C++']