哈希代码离奇RE60pts求助
查看原帖
哈希代码离奇RE60pts求助
473531
zpw_bth楼主2022/12/27 20:45
#include<iostream>
#include<cstdio>
#include<map>
#include<string>
using namespace std;
int n,t;
int a[500004];
bool boool[10000010];
int mo=1e7+7;


int hs(int x){
	return x%mo;
}


int main(){
	scanf("%d",&t);
	while(t--){
		scanf("%d",&n);
		for(int i=1;i<=n;i++){
			scanf("%d",&a[i]);
			if(!boool[hs(a[i])]){
				cout<<a[i]<<' ';
				boool[hs(a[i])]=1;
			}
		}
		for(int i=1;i<=n;i++){
			boool[hs(a[i])]=0;
		}
		printf("\n");
	}
}
2022/12/27 20:45
加载中...