short and fast ^^
\nbool canFormArray(vector<int>& a, vector<vector<int>>& p)\n{\n\tunordered_map<char, char> m;\n\tfor(char i{0}; i<size(p); m[p[i][0]] = i, i++);\n\n\tfor(char 
```\nbool canFormArray(vector<int>& a, vector<vector<int>>& p)\n{\n\tunordered_map<char, char> m;\n\tfor(char i{0}; i<size(p); m[p[i][0]] = i, i++);\n\n\tfor(char i{0}; i<size(a); i += size(p[m[a[i]]]))\n\t\tif(m.find(a[i])==m.end() or size(p[m[a[i]]])+i>size(a) or !equal(begin(p[m[a[i]]]), end(p[m[a[i]]]), begin(a)+i)) return false;\n\n\treturn true;\n}\n```\nor\n```\nbool canFormArray(vector<int>& a, vector<vector<int>>& p)\n{\n\tchar m[101]{0};\n\tfor(char i{0}; i<size(p); m[p[i][0]] = i+1, ++i);\n\n\tfor(char i{0}; i<size(a); i += size(p[m[a[i]]-1]))\n\t\tif(!m[a[i]] or size(p[m[a[i]]-1])+i>size(a) or !equal(begin(p[m[a[i]]-1]), end(p[m[a[i]]-1]), begin(a)+i)) return false;\n\n\treturn true;\n}\n```\nor\n```\nbool canFormArray(vector<int>& a, vector<vector<int>>& p)\n{\n\tvector m(101,-1);\n\tfor(char i{0}; i<size(p); m[p[i][0]] = i, ++i);\n\n\tvector<int> b;\n\tfor(char i{0}, j{0}; i<size(a) and (j = m[a[i]])+1; i += size(p[j]))\n\t\tcopy(p[j].begin(), p[j].end(), back_inserter(b));\n\n\treturn a==b;\n}\n```\n
['C', 'C++']