求问bitset开较大空间为什么会导致本地RE
  • 板块学术版
  • 楼主Mo默Sh笙
  • 当前回复2
  • 已保存回复2
  • 发布时间2023/8/16 20:53
  • 上次更新2023/11/3 03:17:05
查看原帖
求问bitset开较大空间为什么会导致本地RE
189485
Mo默Sh笙楼主2023/8/16 20:53
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define db double
#define il inline
#define re register
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define F(i,a,b) for(re int (i)=(a);(i)<=(b);(i)++)
#define DF(i,a,b) for(re int (i)=(a);(i)>=(b);(i)--)
#define G(i,u) for(re int (i)=head[u];(i);(i)=nxt[(i)])
inline ll read(){ll x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-48;ch=getchar();}return x*f;}
const int N=400010,MAXX=20000000;
int n;
int a[N];
bitset<MAXX+10> t,T;
int main()
{
	n=read();
	F(i,1,n) a[i]=read();
	F(i,1,n) t[a[i]]=1;
	F(i,1,n)
	{
		t[a[i]]=0;
		T^=t<<a[i];
	}
	int ans=0;
	F(i,1,MAXX)
		if(T[i]) ans^=i;
	printf("%d",ans);
	return 0;
}
2023/8/16 20:53
加载中...