Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define endl "\n"
- using namespace std;
- using ll = long long;
- using ld = long double;
- using pii = pair<int, int>;
- constexpr int N = 1e5 + 5;
- int n;
- set<int> st;
- vector<int> ans;
- void Solve() {
- cin >> n;
- for (int i = 0, v; i < n; i++) {
- cin >> v;
- if (st.insert(v).second)
- ans.push_back(v);
- }
- cout << ans.size() << endl;
- for (int v: ans)
- cout << v << " ";
- }
- int main() {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- // cin >> t;
- // while(t--)
- //auto start = chrono::high_resolution_clock::now();
- Solve();
- //auto end = chrono::high_resolution_clock::now();
- //cout << endl << (chrono::duration_cast<chrono::duration<double>>(end - start)).count();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement