C++ easy solution using hash_map
map[arr[i]] - 1: the current vector in pieces, visited[map[arr[i]] - 1]: the current number in pieces[i]\nmap: key is the number in vector> pieces, value is the
map[arr[i]] - 1: the current vector in pieces, visited[map[arr[i]] - 1]: the current number in pieces[i]\nmap<int, int>: key is the number in vector<vector<int>> pieces, value is the position in  vector<vector<int>> pieces.\nvector< >visited: the position of every vector pieces[i] in vector<vector<int>>pieces visited.\nUsing hash_map, we can easily find the corresponding position of number arr[i] in hash_map. Every time when arr[i] is visited, we find the item in pieces, and push the next item to hash_map and map[arr[i]]=0, like popping it out. \n```\nbool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {\n    unordered_map<int, int> map;\n    int m = (int)arr.size(), n = (int)pieces.size();\n    vector<int> visited(n, 0);\n    for (int i = 0; i < n; i++) {\n        map[pieces[i][0]] = i + 1;\n        visited[i]++;\n    }\n    for (int i = 0; i < m; i++) {\n        if (!map[arr[i]]) return false;\n        int piecePos = map[arr[i]] - 1, piecesInPos = visited[piecePos];\n        if (piecesInPos < pieces[piecePos].size()) {\n            map[pieces[piecePos][piecesInPos]] = piecePos + 1;\n            visited[piecePos]++;\n        }\n        map[arr[i]] = 0;\n    }\n    return true;\n}
[]