leetcode787. K 站中转内最便宜的航班

class Solution {
public:
    int findCheapestPrice(int n, vector<vector<int>>& flights, int src, int dst, int k) {
            int inf=INT_MAX/2;
            vector<int>dist(n,inf);
            dist[src]=0;
            for(int i=0;i<=k;i++){
                vector<int>last(dist);
                 for(auto t:flights){
                    dist[t[1]]=min(dist[t[1]],last[t[0]]+t[2]);
                }
            }
        return dist[dst]==inf?-1:dist[dst];
    }
};