QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#60402#4446. Link is as bearqinjianbin#WA 257ms2388kbC++17675b2022-11-04 14:05:242022-11-04 14:05:27

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-04 14:05:27]
  • 评测
  • 测评结果:WA
  • 用时:257ms
  • 内存:2388kb
  • [2022-11-04 14:05:24]
  • 提交

answer

#include<cstdio>

typedef long long LL;

const int maxn =1e5+5;
const int log2maxn =60;

int n;
LL p[maxn];
LL a[maxn]; 

void standing_by()
{
	int i,j;
	LL k;
	for(i=0;i<log2maxn;i++)
		p[i]=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		if (a[i]==0) continue;
		k=a[i];
		for(j=log2maxn-1;j>=0;j--)
			if (p[j])
			{
				k^=p[j];
			}else if ((k>>j)&1)
			{
				p[j]=k;
				break;
			}
	}
}

void complete()
{
	LL ans=0;
	int i;
	for(i=log2maxn-1;i>=0;i--)
		ans^=p[i];
	
	printf("%lld\n",ans);
}

int main()
{
	int t;
	scanf("%d",&t);
	for(;t;t--)
	{
		standing_by();
		complete();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 257ms
memory: 2388kb

input:

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

output:

807362878451973
612302604538312
86998077902582
610594232459172
925444377944686
26026247705280
83596216638747
643062952400284
444672189691262
381703976005303
346975716888311
31399365502695
622170114782608
300917841899385
108234717312356
546962061949298
217231264533635
429518625181016
737414186173485
...

result:

wrong answer 1st lines differ - expected: '1125899906842623', found: '807362878451973'