比赛 EYOI暨SBOI暑假快乐赛5th 评测结果 AAAAAAAAAA
题目名称 AND Sorting 最终得分 100
用户昵称 遥时_彼方 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2022-06-29 11:13:29
显示代码纯文本
#include<bits/stdc++.h>
#define rep(x,y,z) for(int x=y;x<=z;x++)
#define drep(x,y,z) for(int x=y;x>=z;x--)
#define ull unsigned long long
#define ll long long
using namespace std;
inline int read()
{
	int x=0;bool flag=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')flag=0;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	if(flag) return x;
	return ~(x-1);
} 
inline void write(int x)
{
	if(x<0) {x=~(x-1);putchar('-');}
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
/////////////////////////
const int N=2e5+50;
int tc,nc;
int ans;
inline void solve()
{
	ans=(1<<30)-1;
	nc=read();
	int s1;
	rep(i,0,nc-1)
	{
		s1=read();
		if(s1!=i) ans&=(s1&i);
	}
	cout<<ans<<endl;
}
int main()
{
    freopen("and_sorting.in","r",stdin);
	freopen("and_sorting.out","w",stdout);
    tc=read();
    rep(i,1,tc) solve();
    return 0;
}