Advertisement
newb_ie

Untitled

Oct 4th, 2021
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main () {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7. cout.tie(nullptr);
  8. //~ set<int> st;
  9. //~ st.insert(3);
  10. //~ st.insert(3);
  11. //~ st.insert(1);
  12. //~ st.insert(2);
  13. //nlog(n)
  14. //1 2 3
  15. //~ for (auto x : st) {
  16. //~ cout << x << ' ';
  17. //~ }
  18. //~ for (auto it = st.begin(); it != st.end(); it++) {
  19. //~ cout << *it << ' ';
  20. //~ }
  21. int n;
  22. cin >> n;
  23. set<int> st;
  24. for (int i = 0; i < n; ++i) {
  25. int x;
  26. cin >> x;
  27. st.insert(x);
  28. }
  29. cout << (int) st.size() << '\n';
  30. }
  31.  
  32. //oj link : https://cses.fi/
  33. //problem link : https://cses.fi/problemset/task/1621
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement