
用auto可以过
class Solution {
public:
    long long maxScore(vector<int>& a, vector<int>& b) {
        int n = b.size();
        
        vector<vector<long long>> memo(4,vector<long long>(b.size(), LLONG_MIN));
        auto dfs = [&](auto&& dfs, int i, int j)->long long{
            //if (j < 0) return LLONG_MIN/2;  // b 的索引小于 0,返回 0
            if (i < 0) return 0;  // a 的索引小于 0,返回 0
            if (j < 0) return LLONG_MIN/2;
            // 选择当前 a[i] 和 b[j] 的得分或不选
            
            auto& res = memo[i][j];
            if(res==LLONG_MIN){
                res=max(dfs(dfs, i, j-1), dfs(dfs, i-1, j-1)+(long long)a[i]*b[j]);
            }
            return res;
        };
        
        return dfs(dfs, 3, n - 1);
    }
};


















