-
Notifications
You must be signed in to change notification settings - Fork 0
/
cp128.cpp
47 lines (44 loc) · 1023 Bytes
/
cp128.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
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int t;
cin >> t;
while(t--){
int n;
cin >> n;
vector<ll> v(n);
for(int i=0; i<n; i++){
cin >> v[i];
}
sort(v.begin(), v.end());
if(v[0] == v[n-1]){
cout << -1 << endl;
}
else{
vector<int> c;
int i = n-1;
int ele = v[n-1];
while(i>=0){
if(v[i] == ele){
c.push_back(ele);
v.pop_back();
}
else{
break;
}
i--;
}
cout << v.size() << " " << c.size() << endl;
for(int i=0; i<v.size(); i++){
cout << v[i] << " ";
}
cout << endl;
for(int i=0; i<c.size(); i++){
cout << c[i] << " ";
}
cout << endl;
}
}
return 0;
}