feat(codeforces): 1062 div 4
This commit is contained in:
parent
6fc5131466
commit
7b9271093d
6 changed files with 296 additions and 0 deletions
33
codeforces/1062/2167c.cc
Normal file
33
codeforces/1062/2167c.cc
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
vector<int> a;
|
||||
int n;
|
||||
void solve() {
|
||||
cin >> n;
|
||||
a.resize(n);
|
||||
bool odd = false, even = false;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
cin >> a[i];
|
||||
odd |= a[i] & 1;
|
||||
even |= a[i] % 2 == 0;
|
||||
}
|
||||
|
||||
if (odd && even) {
|
||||
sort(begin(a), end(a));
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
cout << a[i] << " \n"[i == n - 1];
|
||||
}
|
||||
}
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
for (int i = 0; i < t; ++i) {
|
||||
solve();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue