QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#197283#4446. Link is as bearyiyiyi#AC ✓206ms3564kbC++141.0kb2023-10-02 14:02:462023-10-02 14:02:46

Judging History

你现在查看的是最新测评结果

  • [2023-10-02 14:02:46]
  • 评测
  • 测评结果:AC
  • 用时:206ms
  • 内存:3564kb
  • [2023-10-02 14:02:46]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define inf 0x3f3f3f3f
#define re register
#define N 200203
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
const int mo=1000000007;
struct bit{
	int a[64];
	const int m=63;
	bit(){memset(a,0,sizeof(a));}
	bool ins(int x){
		for (int i=m;~i;--i)
			if (x&(1ll<<i))
				if (!a[i]){a[i]=x;return 1;}
				else x^=a[i];
		return 0;
	}
	bool check(int x){
		for (int i=m;~i;--i)
			if (x&(1ll<<i))
				if (!a[i])return 0;
				else x^=a[i];
		return 1;
	}
	int getmx(){
		int res=0;
		for (int i=m;~i;--i)
			if ((res^a[i])>res)
				res^=a[i];
		return res;
	}
}b;
inline int read(){
	int x=0,w=0;char ch=getchar();
	while (!isdigit(ch))w|=ch=='-',ch=getchar();
	while (isdigit(ch))x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	return w?-x:x;
}
void solve(){
	memset(b.a,0,sizeof(b.a));
	int n=read(),ans=0,xo=0;
	
	for (int i=1;i<=n;++i)b.ins(read());
	cout<<b.getmx()<<endl;
}
signed main(){
    int T=read();
    while (T--)solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 206ms
memory: 3564kb

input:

22222
100000
595189703884863 72716684812661 449525802123580 504421888022388 390139608591346 108895143840760 170477720052912 185583843894744 201608404318832 128831549357316 521084715261656 668960191579878 573530403227342 489014525501629 56366633717911 1705111713690 227582321537214 710815946393065 169...

output:

1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
1125899906842623
11258999068...

result:

ok 22222 lines