func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N_MAX = 1e5;   bool in[N_MAX + 1];   int t, n, a[N_MAX], m[N_MAX], pr[N_MAX + 1];   vector<int> inc;   vector<vector<int>> sol;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> t;     while (t--) {       cin >> n;       for (int i = 0; i < n; i++) cin >> a[i];       int k = 1, rem = n;       while ((k + 1) * (k + 2) <= 2 * n) k++;       for (int i = 1; i <= n; i++) in[i] = true;       sol.clear();       while (0 < rem) {         inc.clear();         for (int i = 0; i < n; i++) {           if (!in[a[i]]) continue;           if (inc.empty() || a[i] > inc.back()) {             pr[a[i]] = (inc.empty() ? -1 : inc.back());             inc.push_back(a[i]);           } else {             auto it = upper_bound(inc.begin(), inc.end(), a[i]);             *it = a[i];             pr[a[i]] = (it == inc.begin() ? -1 : *(it - 1));           }         }         if (inc.size() <= k) {           int first = sol.size();           sol.push_back(vector<int>());           m[first] = n + 1;           for (int i = 0; i < n; i++) {             if (!in[a[i]]) continue;             if (m[(int)sol.size() - 1] < a[i]) {               m[sol.size()] = a[i];               sol.push_back(vector<int>());               sol.back().push_back(a[i]);               continue;             }             int l = first, r = (int)sol.size() - 1;             while (l < r) {               int mid = (l + r) / 2;               if (m[mid] > a[i])                 r = mid;               else                 l = mid + 1;             }             sol[l].push_back(a[i]);             m[l] = a[i];           }           break;         }         stack<int> st;         int act = inc.back();         while (act != -1) {           st.push(act);           act = pr[act];         }         sol.push_back(vector<int>());         while (!st.empty()) {           sol.back().push_back(st.top());           st.pop();         }         for (int i : sol.back()) in[i] = false;         rem -= inc.size();         while (2 * rem < k * (k + 1)) k--;       }       cout << sol.size() <<   n ;       for (int i = 0; i < sol.size(); i++) {         cout << sol[i].size();         for (int s : sol[i]) cout <<     << s;         cout <<   n ;       }     }     return 0;   }   