-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path612-meximization.cpp
More file actions
39 lines (36 loc) · 843 Bytes
/
Copy path612-meximization.cpp
File metadata and controls
39 lines (36 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Meximization [1497A]
* Problem: https://codeforces.com/problemset/problem/1497/A
* Verdict: ACCEPTED Solved: 2021-03-17
* Language: C++17 (GCC 7-32)
* Runtime: 31 ms Memory: 200 KB
* Tags: brute force, data structures, greedy, sortings
* Author: BidoTeima
* Source: https://codeforces.com/contest/1497/submission/110189134
*/
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<ll> a(n);
vector<ll> freq(105, 0);
for (auto& i : a) cin >> i, freq[i]++;
vector<ll>ans;
for (int i = 0; ans.size() < a.size(); i++, i%=101) {
if (freq[i]>0) ans.push_back(i);
--freq[i];
}
for (auto& i : ans)cout << i << ' ';
cout << '\n';
}
return 0;
}