Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- //
- #define ll long long
- #define ull unsigned long long
- #define mx 100010
- #define mod 1000000007
- #define inf INT_MAX
- #define pi acos(-1)
- #define endl '\n'
- #define pb push_back
- #define pll pair<ll, ll>
- #define Fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
- //
- int main() {
- ll n;
- cin >> n;
- queue<ll> q;
- multiset<ll> se;
- for (ll i = 0; i < n; i++) {
- ll a;
- cin >> a;
- if (a >= 0) se.insert(a);
- else q.push(a);
- }
- for (auto it = se.begin(); it != se.end(); it++) cout << *it << " ";
- while (!q.empty()) {
- cout << q.front() << " ";
- q.pop();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement