Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <vector>
- #include <string>
- #include <queue>
- #include <map>
- #include <set>
- #include <string>
- #include <algorithm>
- #include <cmath>
- using namespace std;
- #define ll long long
- #define nl endl
- #define cy cout << "YES\n"
- #define cn cout << "NO\n"
- #define sz s.size()
- void sherry()
- {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- int main()
- {
- sherry();
- ll n;
- cin >> n;
- deque<ll> dq;
- vector<ll> v(n);
- for (ll i = 0; i < n; i++)
- {
- cin >> v[i];
- }
- sort(v.begin(), v.end(), greater<ll>());
- for (ll i = 0; i < n; i++)
- {
- if (v[i] != v[i - 1])
- {
- dq.push_front(v[i]);
- }
- else
- {
- dq.push_back(v[i]);
- }
- }
- for (auto &i : dq)
- cout << i << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement