c++ dijkstra solution
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
// lc
#define vi vector<int>
#define vvii vector<vi>
#define vpii vector<pair<int,int>>
#define pii  pair<int,int>
#define ll long long int
#define vs vector<string>
#define mii map<int, int>
#define umii unordered_map<int, int> 
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define sall(x) sort(x.begin(), x.end());
#define rall(x) sort(x.rbegin(), x.rend())
#define pb push_back 
#define in insert
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define sall(x) sort(x.begin(), x.end());
#define rall(x) sort(x.rbegin(), x.rend())
#define MAX(x) *max_element(x.begin(), x.end())
#define MIN(x) *min_element(x.begin(), x.end())
#define SUM(X) accumulate(X.begin(), X.end(), 0LL)
#define rev(a) reverse(a.begin(), a.end());
const int mod = 1e9 + 7;

class Solution {
public:
    int minCost(int maxTime, vector<vector<int>>& edges, vector<int>& passingFees) {
        int n = passingFees.size();
        vi cost(n,INT_MAX), time(n,INT_MAX);
        vector<vpii> adj(n);
        for(auto it: edges) {
            adj[it[0]].pb({it[1], it[2]});
            adj[it[1]].pb({it[0], it[2]});
        }
        // map<pair<int,pii>,int> dp;
        // auto rec = [&](int node, int par, int time, auto &&self)->int{
        //      if(node == n-1) return passingFees[node];
        //      if(dp.count({node, {par, time}})) return dp[{node, {par, time}}];
             
        //      int ans = INT_MAX;
        //      for(auto it: adj[node]){
        //         int v = it.ff;
        //         int t = it.ss;
        //         if((v != par) and (time + t <= maxTime)) {
        //            ans = min(ans, passingFees[node] + self(v, node, t+time, self));
        //         }
        //      }
        //      return dp[{node, {par, time}}] = ans;
        // };
        // int ans = rec(0,-1,0,rec);
        // return (ans >= INT_MAX) ? -1 : ans;

        priority_queue<pair<int,pii>, vector<pair<int,pii>>, greater<>> pq;
        pq.push({0,{0,0}});
        cost[0] = 0;  
        time[0] = 0;

        while(pq.size()) {
            int c = pq.top().ff;
            int t = pq.top().ss.ff;
            int node = pq.top().ss.ss;
            pq.pop(); 

            for(auto it: adj[node]) {
                int v = it.ff;
                int tt = it.ss;
                if(t + tt <= maxTime) {
                    if((cost[v] >= c + passingFees[v])) { 
                        cost[v] = c + passingFees[v]; 
                        time[v] = t + tt;
                        pq.push({cost[v], {time[v], v}});
                    } else if((t + tt < time[v])) { 
                        time[v] = t + tt; 
                        pq.push({c + passingFees[v], {time[v], v}});
                    }
                }
            }
        }
        // rep(i,0,n) cout<<cost[i]<<" ";
        // cout<<endl;
        int c =  cost[n-1];
        if(c>=INT_MAX) return -1;
        cout<<c<<" "<<passingFees[0]<<endl;
        return (c + passingFees[0]);
    }
};
```
['C++']