Modified Dijkstra's (Readable C++)
\n\nclass Solution {\n\t//Edge represents that there is edge pointing to val and time to reach val is time\n    struct Edge {\n        int val, time;\n        E
\n```\nclass Solution {\n\t//Edge represents that there is edge pointing to val and time to reach val is time\n    struct Edge {\n        int val, time;\n        Edge(int val, int time) : val(val), time(time) {}\n    };\n\t//Node stores value of node, cost & time to reach from source to current node\n    struct Node {\n        int cost, time, val;\n        Node(int cost, int time, int val) : cost(cost), time(time), val(val) {}\n    };\n    struct Comp {\n        bool operator()(Node& n1, Node& n2) {\n            if(n1.cost == n2.cost)\n                return n1.time > n2.time;\n            return n1.cost > n2.cost;\n        }\n    };\npublic:\n    int minCost(int maxTime, vector<vector<int>>& edges, vector<int>& passingFees) {\n        int n = passingFees.size();\n        vector<Edge> adj[n];\n        for(auto e: edges) {\n            adj[e[0]].push_back(Edge(e[1], e[2]));\n            adj[e[1]].push_back(Edge(e[0], e[2]));\n        }\n        vector<int> cost(n, INT_MAX), time(n, INT_MAX);\n        cost[0] = passingFees[0];\n        time[0] = 0;\n        priority_queue<Node, vector<Node>, Comp> pq;\n        pq.push(Node(cost[0], 0, 0));\n        while(!pq.empty()) {\n            Node node = pq.top();\n            pq.pop();\n            for(Edge edge : adj[node.val]) {\n                if(edge.time + node.time <= maxTime) {\n                    int totCost = node.cost + passingFees[edge.val];\n                    int totTime = edge.time + node.time;\n\t\t\t\t\t//if totalCost is lesser then we\'ll push node in queue\n                    if(cost[edge.val] > totCost) {\n                        cost[edge.val] = totCost;\n                        time[edge.val] = totTime;\n                        pq.push(Node(totCost, totTime, edge.val));\n                    } \n\t\t\t\t\t//else if totalCost is lesser then we\'ll push node in queue\n\t\t\t\t\telse if(time[edge.val] > totTime) {\n                        time[edge.val] = totTime;\n                        pq.push(Node(totCost, totTime, edge.val));\n                    }\n                }\n            }\n        }\n        return cost[n-1] == INT_MAX ? -1 : cost[n-1];\n    }\n};\n```
['C']