-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1859A United We Stand.cpp
52 lines (51 loc) · 1.2 KB
/
1859A United We Stand.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
author : MishkatIT
created : Saturday 2023-08-12-20.38.43
*/
#include<bits/stdc++.h>
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug(_) cout << #_ << " is " << _ << '\n';
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = 1e9 + 7;
const ll N = 1e5 + 10;
const ll inf = 1e9;
const ll linf = 1e18;
int main()
{
fio;
int t;
cin >> t;
while(t--) {
int n;
cin >> n;
vector<int>v(n);
vector<int> b, c;
for (auto& i : v) {
cin >> i;
}
sort(v.rbegin(), v.rend());
for (int i = 0; i < n; i++) {
if(c.size() == 0 || c.back() == v[i]) {
c.push_back(v[i]);
} else {
b.push_back(v[i]);
}
}
if(b.size() == 0) {
cout << -1 << '\n';
} else {
cout << b.size() << ' ' << c.size() << '\n';
for (auto& i: b) {
cout << i << ' ';
}
cout << '\n';
for (auto& i: c) {
cout << i << ' ';
}
cout << '\n';
}
}
return 0;
}