var pos,neg: integer; i,k,x: integer; ev,un: integer; a,b: array [1..n] of integer;
begin for i := 1 to n do read(a[i]); k := 0; pos := 0; neg := 0; for i := 1 to n do begin ev := 0; un := 0; x := a[i]; if x <> 0 then if x > 0 then if (x < pos) or (pos = 0) then pos := x else else if (x > neg) or (neg = 0) then neg := x; x := abs(x); while x <> 0 do begin if odd(x) then un := un + 1 else ev := ev + 1; x := x div 10 end; if un = ev then begin k := k + 1; b[k] := a[i] end end;
writeln(pos,' ',neg); for i := 1 to k do write(b[i],' ') end.
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
srand(time(NULL));
int n;
cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++)
a[i] = rand() % 28 - 11;
reverse(a.begin(),a.end());
for(auto i: a)
cout << i << " ";
}