QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#493484#8520. Xor PartitionsMSS_Eggdrop#WA 1ms3948kbC++14725b2024-07-27 09:46:222024-07-27 09:46:26

Judging History

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

  • [2024-07-27 09:46:26]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3948kb
  • [2024-07-27 09:46:22]
  • 提交

answer

#include <bits/stdc++.h>
#define fi first
#define se second
#define lb lower_bound
#define pb push_back
#define MOD 1000000007
#define INF (1ll<<60);
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

int N;
LL D[65], S=1; 

int main(){
	scanf("%d", &N);
	LL x=0;
	for (int i=1; i<=N; i++){
		LL a;
		scanf("%d", &a);
		x ^= a;
		LL dp = S % MOD * x % MOD;
		for (int j=0; j<60; j++){
			if (x & (1ll << j)) dp = (dp - ((1ll << j) % MOD * D[j] % MOD) + MOD) % MOD;
			else dp = (dp + ((1ll << j) % MOD * D[j] % MOD)) % MOD;
		}
		S = (S + dp) % MOD;
		for (int j=0; j<60; j++) if (x & (1ll << j)) D[j] = (D[j] + dp) % MOD;
		if (i == N) printf("%lld\n", dp);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3792kb

input:

4
7 3 1 2

output:

170

result:

ok 1 number(s): "170"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

1
0

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

1
1

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

3
1 2 3

output:

16

result:

ok 1 number(s): "16"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

4
0 1 0 1

output:

2

result:

ok 1 number(s): "2"

Test #6:

score: -100
Wrong Answer
time: 1ms
memory: 3752kb

input:

562
918479109239293921 960173570446350728 374394588863436385 418106819278123099 473761712658352147 662782574081105364 824954323015093862 827581845536521847 184394794881199801 820907621998888642 606529830885621237 961790689782125501 582742201855597942 337901250755571075 287706594894797714 18578215893...

output:

617202811

result:

wrong answer 1st numbers differ - expected: '641941658', found: '617202811'