Map水过(或set也行)。
code:
/**************************************************************
Problem: 2761
User: yekehe
Language: C++
Result: Accepted
Time:1060 ms
Memory:10988 kb
****************************************************************/ #include <cstdio>
#include <map>
using namespace std; char tc()
{
static char fl[],*A=fl,*B=fl;
return A==B&&(B=(A=fl)+fread(fl,,,stdin),A==B)?EOF:*A++;
} int read()
{
char c;while(c=getchar(),(c<''||c>'')&&c!='-');int x=,y=;c=='-'?y=-:x=c-'';
while(c=getchar(),c>=''&&c<='')x=x*+c-'';return x*y; } int T,N,d;
map<int,bool>S; int main()
{
// freopen("x.txt","w",stdout);
T=read();
while(T--){
N=read();S.clear();d=;
for(int i=;i<=N;i++){
int x=read();
if(!S[x]){S[x]=true;if(!d){d=;printf("%d",x);}else printf(" %d",x);}
}
puts("");
}
return ;
}