#include<bits/stdc++.h>
using namespace std;
const int p=1e5+7;//Mo
int t,tot,top;
int a[50005];
int adj[p],nxt[p],num[p],stk[p];
void init(){// 初始化哈希表
tot=0;
while(top){
adj[stk[top--]]=0;
}
}
void insert(int key){//插入
int h=key%p;
for(int e=adj[h];e;e=nxt[e]){
if(num[e]==key) return ;
}
//如果表中有这个值就不用再放进去一遍了哦
if(!adj[h]){
stk[++top]=h;
}//把第一次的哈希值存哈希表里边,也就是个栈
//等下可以用来初始化的好东西
nxt[++tot]=adj[h];
adj[h]=tot;
num[tot]=key;
//num值 nxt指向的下一个 adj表头
//链表嘎嘎链表嘎嘎好
}
bool query(int key){//查找
int h=key%p;
for(int e=adj[h];e;e=nxt[e]){
if(num[e]==key) return 1;
}
return 0;
}
int main(){
cin>>t;
while(t){
t--;
int n;
cin>>n;
init();
for(int i=1;i<=n;i++){
cin>>a[i];
if(query(a[i])){
a[i]=0;
continue;
}
insert(a[i]);
}
for(int i=1;i<=n;i++){
if(a[i]!=0){
if(i==1)
cout<<a[i];
else cout<<" "<<a[i];
}
}
if(t!=1)
cout<<endl;
}
return 0;
}
大佬们救救我
样例我都过了,是什么小细节的问题吗w