Advertisement
Ankit_132

C

Feb 7th, 2024
1,054
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int t;
  6.     cin>>t;
  7.    
  8.     while(t--){
  9.         int n;
  10.         cin>>n;
  11.         vector<int> ans, pos(n+1,0);
  12.    
  13.         for(int i=1;i<=2*n;i++)
  14.         {
  15.             int x; cin>>x;
  16.             if(!pos[x])
  17.                 ans.push_back(x);
  18.    
  19.             pos[x]=1;
  20.         }
  21.    
  22.         for(int i=0;i<n;i++)
  23.             cout<<ans[i]<<" ";
  24.         cout<<"\n";
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement