你可以参考一下这个代码
```cpp
#include<bits/stdc++.h>
#include<set>
using namespace std;
int t,n;
set<int> s;
int main()
{
scanf("%d",&t);
while(t--)
{
s.clear();
scanf("%d",&n);
for(int i=1,x;i<=n;i++)
{
scanf("%d",&x);
if(!s.count(x))
{
s.insert(x);
printf("%d ",x);
}
}
printf("\n");
}
return 0;
}
by Hugh_Yu @ 2024-09-08 13:24:52
@[Hugh_Yu](/user/1042965) 但我这是红黑树
by Hugh_Yu @ 2024-09-08 13:25:55