解法:
取巧
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define endl '\n'int main() {ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);int t, n;cin >> t;while (t--) {cin >> n;vector<int> vec(n, 0);for (int i = 0; i < n; i++) cin >> vec[i];sort(vec.begin(), vec.end(), greater<int>());cout << 1 << endl << vec[n - 1] << endl;cout << n - 1 << endl;for (int i = 0; i < n - 1; i++) cout << vec[i] << " ";cout << endl;}return 0;
}