蒟蒻求助,本来想用set骗点分,但是后面四个点不是TLE而是WA是什么情况
查看原帖
蒟蒻求助,本来想用set骗点分,但是后面四个点不是TLE而是WA是什么情况
367619
otislee601楼主2021/2/22 11:43

RT,我的代码

#include <iostream>
#include <cstdio>
#include <set>
using namespace std;
set <int> s;
inline int read()
{
	register int ans=0;
	register char c=getchar();
	while(c < '0'||c > '9') c=getchar();
	while(c>='0'&&c<='9')
	{
		ans=ans*10+(c-'0');
		c=getchar();
	}
	return ans;
}
int main() 
{
//	freopen("test1.in","r",stdin); 
	register int t,tmp,n;
	t=read();
	while(t--)
	{
		s.clear();
		n=read();
		for(register int i = 0;i < n;++i)
		{
			tmp=read();
			if(s.find(tmp)==s.end())
			{
				s.insert(tmp);
				printf("%d ",tmp);
			}
		 }
		 putchar('\n');
	}
	return 0;
}
 
2021/2/22 11:43
加载中...