fork download
  1. #include <iostream>
  2. #include<math.h>
  3. #include<vector>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int n, k0, k1;
  10. cin >> n;
  11. vector<int>V(n);
  12. k1=0; k0=0;
  13. for (int i = 0; i<n; i++) {cin >> V[i];}
  14. for (int i = 0; i<n; i++) {if (V[i]%2==1) {cout << V[i]<<" "; k1++;};}
  15. cout<<endl;
  16. for (int i = 0; i<n; i++) {if (V[i]%2==0) {cout << V[i]<<" "; k0++;};}
  17. cout<<endl;
  18. if (k0>=k1) {cout<<"YES";} else {cout<<"NO";}
  19. }
  20.  
Success #stdin #stdout 0s 4580KB
stdin
	5
4 16 19 31 2
stdout
19 31 
4 16 2 
YES