| 3 | class Solution { |
| 4 | public: |
| 5 | int networkDelayTime(vector<vector<int>>& times, int N, int K) { |
| 6 | vector<long long int> d(N + 1, INT_MAX); |
| 7 | d[K] = 0; |
| 8 | for (int i = 0; i < N; ++i) { |
| 9 | for (int j = 0; j < times.size(); ++j) { |
| 10 | if (d[times[j][1]] > d[times[j][0]] + times[j][2]) { |
| 11 | d[times[j][1]] = d[times[j][0]] + times[j][2]; |
| 12 | } |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | int a = *max_element(d.begin() + 1, d.end()); |
| 17 | return a >= INT_MAX ? -1 : a; |
| 18 | } |
| 19 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected