[C++] clean DP memoization
For next try to use pairs inside the vector to avoid TLE. next stores the next stop information and the time used on the road.\n\ncpp\nclass Solution {\npublic:
For `next` try to use pairs inside the vector to avoid TLE. `next` stores the next stop information and the time used on the road.\n\n```cpp\nclass Solution {\npublic:\n    int maxi;\n    int n;\n    vector<vector<int>> memo;\n    vector<vector<pair<int, int>>> next;\n    \n    int minCost(int maxTime, vector<vector<int>>& edges, vector<int>& passingFees) {\n        maxi = maxTime;\n        n = passingFees.size();\n        memo.assign(n, vector<int>(maxi + 1, -1));\n        next.assign(n, vector<pair<int, int>>{});\n        for (auto e: edges){\n            next[e[0]].push_back({e[1], e[2]});\n            next[e[1]].push_back({e[0], e[2]});\n        }\n        int ans = dp(passingFees, 0, 0, 0);\n        return (ans == INT_MAX/2) ? -1: ans;\n    }\n    \n    int dp(vector<int>& passingFees, int i, int time, int cost){\n        if (time > maxi) return INT_MAX/2;\n        if (i == n - 1)\n            return passingFees[i];\n        if (memo[i][time] < 0){\n            memo[i][time] = INT_MAX/2;\n            for (auto p: next[i]){\n                int j = p.first, t = p.second;\n                memo[i][time] = min(memo[i][time],\n                                    passingFees[i] + dp(passingFees, j, time + t, cost));\n            }\n        }\n        return memo[i][time];\n    }\n};\n```
[]