Advertisement
limimage

taskK

Apr 21st, 2020
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. #define endl "\n"
  4. using namespace std;
  5. using ll = long long;
  6. using ld = long double;
  7. using pii = pair<int, int>;
  8.  
  9. constexpr int N = 1e5 + 5;
  10.  
  11. int n;
  12. set<int> st;
  13. vector<int> ans;
  14.  
  15. void Solve() {
  16. cin >> n;
  17. for (int i = 0, v; i < n; i++) {
  18. cin >> v;
  19. if (st.insert(v).second)
  20. ans.push_back(v);
  21. }
  22. cout << ans.size() << endl;
  23. for (int v: ans)
  24. cout << v << " ";
  25. }
  26.  
  27. int main() {
  28. ios::sync_with_stdio(false);
  29. cin.tie(nullptr);
  30. cout.tie(nullptr);
  31. // cin >> t;
  32. // while(t--)
  33. //auto start = chrono::high_resolution_clock::now();
  34. Solve();
  35. //auto end = chrono::high_resolution_clock::now();
  36. //cout << endl << (chrono::duration_cast<chrono::duration<double>>(end - start)).count();
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement