Using MCM
\nclass Solution {\n    int dp[101][101];\n    bool cal(int i , int j,vector<int>&a,map<vector<int>,int>&m)\n    {\n        if(i>j) return true;\n        int &a
```\nclass Solution {\n    int dp[101][101];\n    bool cal(int i , int j,vector<int>&a,map<vector<int>,int>&m)\n    {\n        if(i>j) return true;\n        int &ans = dp[i][j];\n        if(ans!=-1) return ans;\n        vector<int> cur;\n        ans = false;\n        for(int k = i ; k <= j ; k ++ )\n        {\n            cur.push_back(a[k]);\n            if(m[cur]==false) continue;\n            if(cal(k+1,j,a,m)) return ans = true;\n        }\n        return ans;\n    }\npublic:\n    bool canFormArray(vector<int>& a, vector<vector<int>>& p) {\n    map<vector<int>,int> m ;\n    for(auto ele : p) m[ele] = 1;\n    memset(dp,-1,sizeof(dp));\n    return cal(0,a.size()-1,a,m);\n    }\n};\n```
[]