后四个点RE,求大佬帮调
查看原帖
后四个点RE,求大佬帮调
1033548
xczsxczs楼主2023/11/9 18:18
#include<bits/stdc++.h>
using namespace std;
int t,n,a[500001],b[500001],c[500001],l;
inline long long read(){
	   long long a=0,fh=1;char c=getchar();
	   while(c>'9'||c<'0'){if(c=='-')fh=-1;c=getchar();}
	   while('0'<=c&&c<='9'){
		   a=a*10ll+c-48ll;
		   c=getchar();
	   }
	   return a*fh;
}
int main(){
	ios::sync_with_stdio(false);
	t=read();
	for(int i=1;i<=t;i++){
		n=read(),l=0;
		memset(b,0,sizeof(b));
		memset(c,0,sizeof(b));
		for(int j=1;j<=n;j++){
			a[i]=read();
			if(b[a[i]]==0)c[++l]=a[i],b[a[i]]=1;
		}
		for(int j=1;j<=l;j++)cout<<c[j]<<" ";
		cout<<endl;
	}
}
2023/11/9 18:18
加载中...