Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <unordered_map>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- unordered_map<int, int> u_mp;
- vector<int> ans;
- for (int i = 0; i < n; ++i)
- {
- int a;
- cin >> a;
- ++u_mp[a];
- }
- for (auto& p : u_mp)
- {
- while (p.second--)
- {
- ans.push_back(p.first);
- }
- }
- for(int i : ans)
- {
- cout << i << ' ';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment