File tree Expand file tree Collapse file tree 1 file changed +30
-4
lines changed Expand file tree Collapse file tree 1 file changed +30
-4
lines changed Original file line number Diff line number Diff line change 1
- // Authored by : BaaaaaaaaaaarkingDog
1
+ // Authored by : jihwan0123
2
2
// Co-authored by : -
3
- // http://boj.kr/****************
3
+ // http://boj.kr/0fd334ddb06d417689cd6c944d5a0585
4
4
#include < bits/stdc++.h>
5
5
using namespace std ;
6
6
7
- int main (void ){
7
+ #define X first
8
+ #define Y second
9
+
10
+ bool cmp (const pair<int , int > &a, const pair<int , int > &b) {
11
+ return a.X > b.X ;
12
+ }
13
+
14
+ int main (void ) {
8
15
ios::sync_with_stdio (0 );
9
16
cin.tie (0 );
10
-
17
+ int n, c;
18
+ cin >> n >> c;
19
+ vector<pair<int , int >> arr; // pair : {cnt, num}
20
+ for (int i = 0 ; i < n; i++) {
21
+ int x;
22
+ cin >> x;
23
+ bool chk = false ;
24
+ for (auto &a : arr) {
25
+ if (a.Y == x) {
26
+ chk = true ;
27
+ a.X ++;
28
+ break ;
29
+ }
30
+ }
31
+ if (!chk) arr.push_back ({1 , x});
32
+ }
33
+ stable_sort (arr.begin (), arr.end (), cmp);
34
+
35
+ for (auto b : arr)
36
+ while (b.X --) cout << b.Y << ' ' ;
11
37
}
You can’t perform that action at this time.
0 commit comments