26 lines
393 B
C++
26 lines
393 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
unordered_set<int> hash;
|
|
deque<int> res;
|
|
|
|
while (n--) {
|
|
int x;
|
|
cin >> x;
|
|
if (hash.find(x) == hash.end()) {
|
|
res.push_back(x);
|
|
hash.insert(x);
|
|
}
|
|
}
|
|
cout << res.size() << '\n';
|
|
while (!res.empty()) {
|
|
cout << res.front() << " ";
|
|
res.pop_front();
|
|
}
|
|
cout << '\n';
|
|
}
|