Advertisement
Josif_tepe

Untitled

May 18th, 2024
829
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <set>
  4. using namespace std;
  5. int main() {
  6.     int n;
  7.     cin >> n;
  8.     set<int> st;
  9.     for(int i = 0; i < n; i++) {
  10.         int x;
  11.         cin >> x;
  12.  
  13.         st.insert(x);
  14.     }
  15.  
  16.     for(int x : st) {
  17.         cout << x << " " ;
  18.     }
  19.     cout << endl;
  20.  
  21.     for(set<int>::iterator it = st.begin(); it != st.end(); it++) {
  22.         cout << *it << " ";
  23.     }
  24.  
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement