C++ STL solution using binary search [4ms]
\nclass Solution {\n   public:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces)\n    {\n\t\t// let n = size(arr) and m = size(pieces)\n    
```\nclass Solution {\n   public:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces)\n    {\n\t\t// let n = size(arr) and m = size(pieces)\n        sort(begin(pieces), end(pieces)); // O(m log m)\n        auto it = cbegin(arr);\n        while (it != cend(arr)) { // O(n)\n            const auto lb = lower_bound(cbegin(pieces), cend(pieces), *it,\n                                        [](const auto& v, const auto& i) { return v.front() < i; }); // O(log m)\n            if (lb == cend(pieces) ||\n                !equal(lb->cbegin(), lb->cend(), it)) break; // O(min(size(piece),n)) worst case \n\n            it += lb->size();\n        }\n        return it == cend(arr);\n    }\n};\n```\n**If you have any doubts or suggestions, please feel free to comment.\nIf you find this solution useful, you know where the upvote is :)**
['C', 'Binary Tree', 'C++']