-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadjhate.cpp
More file actions
36 lines (35 loc) · 729 Bytes
/
adjhate.cpp
File metadata and controls
36 lines (35 loc) · 729 Bytes
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
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<int> odd;
vector<int> even;
for(int i=0;i<n;i++){
int c;
cin>>c;
if(c%2==0){
even.push_back(c);
}
else odd.push_back(c);
}
if(even.size()==0 || odd.size()==0) {
cout<<-1<<"\n";
continue;
}
else{
for(int i=0;i<odd.size();i++){
cout<<odd[i]<<" ";
}
for(int i=0;i<even.size();i++){
cout<<even[i]<<" ";
}
cout<<"\n";
}
}
return 0;
}