QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#608134#8520. Xor Partitionsdww_1337WA 2ms10508kbC++14659b2024-10-03 18:58:562024-10-03 18:58:57

Judging History

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

  • [2024-10-03 18:58:57]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:10508kb
  • [2024-10-03 18:58:56]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
const int p = 1e9 + 7;
const int MAXN = 3e5 + 7;

ll a[MAXN];
ll pre[MAXN];
ll dp[MAXN];

void get_ans(int n)
{
	memset(dp , 0 , sizeof(dp));
	memset(pre , 0 , sizeof(pre));
	dp[0] = 1;
	for(int i = 1 ; i <= n ; i++)
	{
		pre[i] = pre[i - 1] ^ a[i];
	}
	for(int i = 1 ; i <= n ; i++)
	{
		for(int j = 0 ; j <= i - 1 ; j++)
		{
			dp[i] = (dp[i] + (dp[j] * (pre[i] ^ pre[j])) % p ) % p; 
		}
	}
}

int main()
{
	int n;
	scanf("%d" , &n);
	for(int i = 1 ; i <= n ; i++)
	{
		scanf("%lld" , &a[i]);
	}
	get_ans(n);
	printf("%lld" , dp[n]);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 8864kb

input:

4
7 3 1 2

output:

170

result:

ok 1 number(s): "170"

Test #2:

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

input:

1
0

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 1ms
memory: 10144kb

input:

1
1

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 1ms
memory: 9600kb

input:

3
1 2 3

output:

16

result:

ok 1 number(s): "16"

Test #5:

score: 0
Accepted
time: 1ms
memory: 10508kb

input:

4
0 1 0 1

output:

2

result:

ok 1 number(s): "2"

Test #6:

score: -100
Wrong Answer
time: 2ms
memory: 9480kb

input:

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

output:

697190968

result:

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