Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <set>
- #include <vector>
- #include <deque>
- #include <map>
- #include <cmath>
- #include <random>
- #define se second
- #define fi first
- #define mp make_pair
- #define pb push_back
- typedef long long ll;
- typedef long double ld;
- using namespace std;
- bool cmp(int x, int y) {
- if ((x % 2 == 1) && (y % 2 == 0)) return true;
- if ((x % 2 == 0) && (y % 2 == 1)) return false;
- return (x < y);
- }
- int main(){
- vector<int> a = {1, 4, 3, 5, 2, 6};
- sort(a.begin(), a.end(), cmp);
- for (auto e : a) cout << e << ' ';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment