1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm>
using namespace std; typedef long long ll; #define R register #define I inline template<class >void read( &x) { register int c = getchar(), f = 1; x = 0; while(!isdigit(c)) {if (c == '-') f = -1; c = getchar();} while(isdigit(c)) x = x * 10 + c - '0', c = getchar(); x *= f; } const int mod=100003,base=101; int a[mod<<2|1],h[mod<<2|1],n,T; int hash(int x) { return (ll)x*base%mod; } int main(){ read(T); while(T--) { memset(h,0,sizeof(h)); read(n); for(int i=1;i<=n;i++) { read(a[i]); if(!h[hash(a[i])]) printf("%d ",a[i]),h[hash(a[i])]=1; } printf("n"); } return 0; }
|
近期评论