Advertisement
fahad005

Untitled

Oct 29th, 2021
1,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. //
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define mx 100010
  7. #define mod 1000000007
  8. #define inf INT_MAX
  9. #define pi acos(-1)
  10. #define endl '\n'
  11. #define pb push_back
  12. #define pll pair<ll, ll>
  13. #define Fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
  14. //
  15. int main() {
  16.     ll n;
  17.     cin >> n;
  18.  
  19.     queue<ll> q;
  20.     multiset<ll> se;
  21.  
  22.     for (ll i = 0; i < n; i++) {
  23.         ll a;
  24.         cin >> a;
  25.  
  26.         if (a >= 0) se.insert(a);
  27.         else q.push(a);
  28.     }
  29.  
  30.     for (auto it = se.begin(); it != se.end(); it++) cout << *it << " ";
  31.     while (!q.empty()) {
  32.         cout << q.front() << " ";
  33.         q.pop();
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement