QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#716795#8520. Xor PartitionsyhdddRE 36ms7996kbC++141.2kb2024-11-06 16:04:232024-11-06 16:04:26

Judging History

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

  • [2024-11-06 16:04:26]
  • 评测
  • 测评结果:RE
  • 用时:36ms
  • 内存:7996kb
  • [2024-11-06 16:04:23]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define mod 1000000007ll
#define pii pair<int,int>
#define fi first
#define se second
#define mems(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define db double
using namespace std;
const int maxn=200010;
const int inf=1e18;
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch-48);ch=getchar();}
	return x*f;
}
bool Mbe;

int n,a[maxn];
int dp[maxn],s[maxn];
int sum[65][2],pw[65];
void work(){
	n=read();
	for(int i=1;i<=n;i++)a[i]=read(),s[i]=s[i-1]^a[i];
	pw[0]=1;for(int i=1;i<=60;i++)pw[i]=pw[i-1]*2%mod;
	dp[0]=1;
	for(int i=0;i<=60;i++)sum[i][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=60;j++){
			int v=(s[i]>>j)&1ll;
			(dp[i]+=sum[j][v^1]*pw[j])%=mod;
		}
		for(int j=0;j<=60;j++)(sum[j][(s[i]>>j)&1ll]+=dp[i])%=mod;
	}
	printf("%lld\n",dp[n]);
}

// \
444

bool Med;
int T;
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	
//	ios::sync_with_stdio(0);
//	cin.tie(0);cout.tie(0);
	
//	cerr<<(&Mbe-&Med)/1048576.0<<" MB\n";
	
	T=1;
	while(T--)work();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
7 3 1 2

output:

170

result:

ok 1 number(s): "170"

Test #2:

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

input:

1
0

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

1
1

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

3
1 2 3

output:

16

result:

ok 1 number(s): "16"

Test #5:

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

input:

4
0 1 0 1

output:

2

result:

ok 1 number(s): "2"

Test #6:

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

input:

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

output:

641941658

result:

ok 1 number(s): "641941658"

Test #7:

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

input:

806
154088894908249861 515620644168920420 987371724389985655 237699073224022026 870013393084040616 381176515155022022 684658378726319957 263518193038353112 315710296046387135 551218921219797967 118207002034108547 368754899860827737 935813803983235940 144555339393414539 776366257845243712 97482835862...

output:

322263213

result:

ok 1 number(s): "322263213"

Test #8:

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

input:

730
504625950218841699 11051067425914472 76969373706503912 549617734382960079 841136352271894226 827409290048280121 385214931443507037 450322494678858761 648956361691910260 885215198848035026 943077096807914988 563680977442136779 928183411196746637 238397217357311158 42194234771144128 13855813780489...

output:

302666182

result:

ok 1 number(s): "302666182"

Test #9:

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

input:

810
799481157885297669 36700891760566107 106799307598176179 525457060642356612 692305388685262192 734925968562669769 944342162656870872 318551639297444833 948338452318307252 947010621108694579 847591264136215873 843729821439293876 795197982657816209 514358412232554388 824474357024876223 262652125198...

output:

602149347

result:

ok 1 number(s): "602149347"

Test #10:

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

input:

753
19680670121054815 730848550760427515 382393175530043476 135251628628086143 953972980324431759 968402030274542386 239081692291889007 208406098506299898 210617837980094596 241386761622363415 614349192152783697 674634709373373543 954789607048365380 176448580882244695 495604367525148905 838787911842...

output:

444552931

result:

ok 1 number(s): "444552931"

Test #11:

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

input:

1000
5910966043171798 444610656319788280 3688812861187777 527406121506858974 348651678231967453 742595325576725873 269979149588588141 367500509520651713 721087042810251324 781730710329969382 273470825025201702 217943660725681870 798497786765762465 932985478420399210 51222819072897891 123000680900329...

output:

375397549

result:

ok 1 number(s): "375397549"

Test #12:

score: 0
Accepted
time: 5ms
memory: 7996kb

input:

10000
836416588552416746 715139925233188073 540045750150764470 657083656580111699 453024602030341020 32332432208735263 675754504084029016 182620749259887560 238151424129511167 51110718389056302 51405438498364014 122526276542156527 610483897196537731 847874891186284312 145487013148799803 786588991661...

output:

465337540

result:

ok 1 number(s): "465337540"

Test #13:

score: 0
Accepted
time: 36ms
memory: 6896kb

input:

100000
730682239762265959 307059402620664122 115979858233261975 244728110596258449 879226800697788913 227027291248976655 132171973066857319 837530086673521636 990238586667417326 344010698420539749 52603681260480846 974344540159711285 136286036328847931 585214727445181288 444702707623149922 204441001...

output:

837391091

result:

ok 1 number(s): "837391091"

Test #14:

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

input:

122
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: -100
Runtime Error

input:

290961
846377657091027963 867642083997864998 318092818587796046 622637207479893557 96527938269242434 765910401421070700 111007328062052438 784134329098500458 809741882237463364 184802786004174581 848102178687474272 396434268861505821 51257684464611016 536944824906958774 713116046434570909 6816680330...

output:


result: