a53

ElimRep

a53
Jan 21st, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n,v[1001];
  4.  
  5. void printDistinct(int a[],int n)
  6. {
  7. unordered_set<int> s;
  8. for(int i=0;i<n;++i)
  9. if(s.find(a[i])==s.end())
  10. s.insert(a[i]),cout<<a[i]<<' ';
  11. }
  12.  
  13. int main()
  14. {
  15. cin>>n;
  16. for(int i=0;i<n;++i)
  17. cin>>v[i];
  18. printDistinct(v,n);
  19. return 0;
  20. }
Add Comment
Please, Sign In to add comment