fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define ld long double
  7.  
  8. void Free_palestine() {
  9. ios::sync_with_stdio(false);
  10. cin.tie(NULL);
  11. cout.tie(NULL);
  12. }
  13.  
  14. const int N = 2e5 + 5;
  15. const int MOD = 1e9 + 7;
  16.  
  17. signed main(){
  18. Free_palestine();
  19. int n,arr[n],i;
  20. cin>>n;
  21. for(i = 0; i < n; i++){
  22. cin>>arr[i];
  23. }
  24. for(i = 0; i < n; i++){
  25. if(arr[i]%2==0){
  26. cout<<arr[i]<<" ";
  27. }
  28. }
  29. cout<<endl;
  30. for(i = 0; i < n; i++){
  31. if(arr[i]%2!=0){
  32. cout<<arr[i]<<" ";
  33. }
  34. }
  35. }
Success #stdin #stdout 0s 5316KB
stdin
12
stdout
0 0 0 0 0 0 0 0 0 0 0 0