c++ solution
\nclass Solution\n{\npublic:\n    int minCost(int maxtime,vector<vector<int>>&nums,vector<int>&fee) \n    {\n        int n=fee.size();\n        vector<pair<int,
```\nclass Solution\n{\npublic:\n    int minCost(int maxtime,vector<vector<int>>&nums,vector<int>&fee) \n    {\n        int n=fee.size();\n        vector<pair<int,int>>dp[n+100];\n        vector<int>dis(n+1000,INT_MAX);\n        for(auto it:nums)\n        {\n            dp[it[0]].push_back({it[1],it[2]});\n            dp[it[1]].push_back({it[0],it[2]});\n        }\n        priority_queue<vector<int>,vector<vector<int>>,greater<vector<int>>>pq;\n        pq.push({fee[0],0,0});\n        while(pq.size())\n        {\n            auto temp=pq.top();\n            pq.pop();\n            int f=temp[0];\n            int time=temp[1];\n            int node=temp[2];\n            if(node==n-1)\n            {\n                return f;\n            }\n            for(auto it:dp[node])\n            {\n                int new_time=time+it.second;\n                if(new_time<=maxtime&&dis[it.first]>time+it.second)\n                {\n                   dis[it.first]=new_time;\n                   pq.push({f+fee[it.first],new_time,it.first});\n                }\n            }\n        }\n        return -1;\n    }\n};\n```
['Dynamic Programming', 'C', 'C++']