UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#196344#2461. 序列函数wosile100122ms15960kbC++570b2023-10-22 10:33:252023-10-22 12:06:47

answer

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull a[1005],ans[1005][1005];
ull mx[1005][1005];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%llu",&a[i]);
	for(int i=1;i<=n;i++)ans[i][i]=a[i];
	for(int d=1;d<n;d++)for(int i=1;i+d<=n;i++)ans[i][i+d]=ans[i][i+d-1]^ans[i+1][i+d];
	for(int i=n;i>=1;i--)for(int j=1;j<=n;j++)mx[i][j]=max(max(mx[i][j-1],mx[i+1][j]),ans[i][j]);
	while(m--){
		int l,r;
		scanf("%d%d",&l,&r);
		printf("%llu\n",mx[l][r]);
	}
	return 0;
	//quod erat demonstrandum
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1560kb

input:

42 49
1783202742 1774487945 518236540 362135926 386007499 684539866 40822510 1761379686 1956018045 1...

output:

2143704053
2015166884
2144556949
1506308040
2142362987
2146632215
2146632215
2146632215
2068269397
2...

result:

ok 49 lines

Test #2:

score: 10
Accepted
time: 0ms
memory: 1560kb

input:

42 33
807451392 1594697903 822298754 791804335 186109850 378511438 522423033 425169948 1522110804 89...

output:

2122736149
2145707346
2129880922
2050476931
2077925883
2145056931
2145707346
2040286149
2140052661
2...

result:

ok 33 lines

Test #3:

score: 10
Accepted
time: 0ms
memory: 1624kb

input:

50 50
549358834089146323 8281292981227534763 207444435364729985 15702617371830656254 100065109098336...

output:

18349122426892637836
18424642816185963297
18424642816185963297
18424642816185963297
1834912242689263...

result:

ok 50 lines

Test #4:

score: 10
Accepted
time: 0ms
memory: 3400kb

input:

211 288
1541777479237755621 7380930312367719955 18108376653806178106 5478389836749642688 79169076237...

output:

18441496847620896589
18441496847620896589
18445094639670047188
18441496847620896589
1844576586180516...

result:

ok 288 lines

Test #5:

score: 10
Accepted
time: 0ms
memory: 4656kb

input:

300 300
13173047521501495255 10953077477026411483 9510832264046195437 17718064857871536690 697815050...

output:

18446557541718203738
18423433381304363788
18446557541718203738
18104404130056939072
1839536653439987...

result:

ok 300 lines

Test #6:

score: 10
Accepted
time: 3ms
memory: 11308kb

input:

704 823
10383085696588517611 15289910603977389948 8677788864453886692 13752832787548255691 147484473...

output:

18446630762333876316
18423909590519364175
18445223070107393984
18446565292956783316
1844577449320985...

result:

ok 823 lines

Test #7:

score: 10
Accepted
time: 25ms
memory: 15712kb

input:

984 96949
9963157970145598319 14580206340515272781 7491124242731166719 15710061550121502290 17496952...

output:

18446600579277745879
18350702067697472412
18446733764113276192
18446516668583026953
1844325333828644...

result:

ok 96949 lines

Test #8:

score: 10
Accepted
time: 27ms
memory: 14044kb

input:

878 82408
8940297609593388475 5462297751515208042 14733942868464620325 5612045775407545021 647690935...

output:

18446702727635691275
18446699238696255412
18446702727635691275
18446699238696255412
1844635297729416...

result:

ok 82408 lines

Test #9:

score: 10
Accepted
time: 29ms
memory: 12376kb

input:

772 72983
15460039955329036647 7155312777175822862 17006627873007892975 4747353407166593171 14231318...

output:

18445806169258170293
18446480690417164748
18294830692476358701
18446152273808621765
1844580616925817...

result:

ok 72983 lines

Test #10:

score: 10
Accepted
time: 38ms
memory: 15960kb

input:

1000 100000
2221357305344673673 8355251918668090901 490161488299128800 7629701439793791725 513258466...

output:

18442923800112303923
18443578727890069360
18446667346999006141
18398745104155425750
1825524423658037...

result:

ok 100000 lines

Extra Test:

score: 0
Extra Test Passed