Skip to content

Commit 165ecca

Browse files
committed
Finish B of abc408
1 parent 11d4386 commit 165ecca

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

atcoder/abc408/b_compression.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <iostream>
2+
#include <set>
3+
#include <bits/stdc++.h>
4+
using namespace std;
5+
6+
/*
7+
Score: 150
8+
Link: https://atcoder.jp/contests/abc408/tasks/abc408_b
9+
Status: Solved
10+
*/
11+
12+
int main() {
13+
int n;
14+
cin >> n;
15+
16+
// This datastructure already sorts the elements in ascending order.
17+
set<int> s;
18+
19+
int temp;
20+
for(int i = 0; i<n; i++) {
21+
cin >> temp;
22+
s.insert(temp);
23+
}
24+
25+
cout << s.size() << endl;
26+
for(int elem : s) {
27+
cout << elem << " ";
28+
}
29+
cout << endl;
30+
return EXIT_SUCCESS;
31+
}

0 commit comments

Comments
 (0)