Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. typedef pair <int,int> point;
  5. bool comparator(point a , point b)
  6. {
  7.     return a.second % 2 == 0 && b.second % 2 != 0 ;
  8. }
  9. int main()
  10. {
  11.     int n ;
  12.     cin >> n ;
  13. vector <point> a ;
  14. for (int i = 0 ; i < n ; i ++)
  15. {
  16.     int x = 1;
  17.     int y ;
  18.     cin >> y ;
  19.     a.push_back({x , y}) ;
  20. }
  21. sort(a.begin(), a.end(), comparator) ;
  22. for (int i = 0; i < n ; i ++)
  23.     cout << a[i].first << " " << a[i].second << endl ;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement