jakaria_hossain

codeforces - restore the permutation by merger

Jul 17th, 2020
729
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL));
  5. int main()
  6. {
  7.     fast();
  8.     ll t;
  9.     cin>>t;
  10.     while(t--)
  11.     {
  12.         ll n;
  13.         cin>>n;
  14.         ll ara[n*2+1],i;
  15.         for(i=0;i<n*2;i++)cin>>ara[i];
  16.         map<ll,ll>mp;
  17.         for(i=0;i<n*2;i++)
  18.         {
  19.             if(mp[ara[i]]==0)cout<<ara[i]<<" ";
  20.             mp[ara[i]]++;
  21.         }
  22.         cout<<endl;
  23.     }
  24. }
RAW Paste Data