0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-08 16:18:46 +00:00
Baoshuo Ren 2021-08-27 22:37:32 +08:00 committed by Baoshuo Ren
parent 2b1cbc61af
commit 4b6fd25256
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

21
AcWing/838/838.cpp Normal file
View File

@ -0,0 +1,21 @@
#include <bits/stdc++.h>
using namespace std;
int n, m, t;
map<int, int> a;
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> t;
a[t]++;
}
for (auto it = a.begin(); it != a.end(); it++) {
for (int i = 0; i < it->second && m; i++, m--) {
cout << it->first << ' ';
}
}
cout << endl;
return 0;
}