SHARE
TWEET

Untitled

a guest Dec 9th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top