c++ dijkstra concise
\nclass Solution {\npublic:\n    vector<int> dijkstra(vector<vector<pair<int,int>>>& g, int src){\n        int n = g.size();\n        vector<int> ret(n, -1);\n 
```\nclass Solution {\npublic:\n    vector<int> dijkstra(vector<vector<pair<int,int>>>& g, int src){\n        int n = g.size();\n        vector<int> ret(n, -1);\n        \n        priority_queue<pair<int,int>, vector<pair<int,int>>, greater<void>> q;\n        q.push({0,src});\n\n        while(!q.empty()){\n            auto x = q.top(); q.pop();\n            int c = x.first, v = x.second;\n            \n            if(ret[v] != -1) continue;\n            ret[v] = c;\n            for(auto p : g[v]) q.push({p.second + c, p.first});\n        }\n\n        return ret;\n    }\n    \n    int networkDelayTime(vector<vector<int>>& a, int n, int k) {\n        vector<vector<pair<int,int>>> g(n);\n        \n        for(int i=0; i<a.size(); i++){\n            int u = a[i][0] - 1, v = a[i][1] - 1, c = a[i][2];\n            g[u].push_back({v,c});\n        }\n        \n        auto ret = dijkstra(g, k-1);\n        int hi = 0;\n        for(int i=0; i<n; i++){\n            if(ret[i] == -1) return -1;\n            hi = max(hi, ret[i]);\n        }\n        return hi;\n    }\n};\n```
[]