UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#188463#3363. 序列价值xyl1001949ms12908kbC++11474b2023-10-03 09:46:122023-10-03 12:14:25

answer

#include <bits/stdc++.h>
using namespace std;
int a,b,i,aa[1000006][3],q,h;
long long s,c;
int main(){
	scanf("%d%d",&a,&aa[1][0]);
	for(i=2;i<=a;i++){
		scanf("%d",&aa[i][0]),c=aa[i][0],c*=aa[i-1][0];
		s^=c,aa[i-1][2]=i,aa[i][1]=i-1;
	}
	while(--a){
		printf("%lld\n",s);
		scanf("%d",&b),q=aa[b][1],h=aa[b][2];
		if(q!=0)aa[q][2]=h,c=aa[q][0],c*=aa[b][0],s^=c;
		if(h!=0)aa[h][1]=q,c=aa[h][0],c*=aa[b][0],s^=c;
		if(h!=q)c=aa[h][0],c*=aa[q][0],s^=c;
	}
}

详细

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

Test #1:

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

input:

5000
646281266 83426155 32761725 874777117 160325894 106628928 674537652 501242738 414378844 2882889...

output:

92987107493473763
266883714701385089
396513919132497901
140658291623730124
52877620187497517
5315852...

result:

ok 4999 numbers

Test #2:

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

input:

5000
142976290 696375334 5508843 779453902 787743512 557904541 508574771 609120068 624572675 1609158...

output:

1031930973459692648
298456115123965145
989495246110361742
1119691219052826940
717308331052388603
103...

result:

ok 4999 numbers

Test #3:

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

input:

5000
689759187 766269666 113869742 430591091 371364351 455322139 255229431 387889535 950106338 86825...

output:

703584314107632280
818273970002805488
1078949071160741810
1111639403131282587
734364402739245026
875...

result:

ok 4999 numbers

Test #4:

score: 10
Accepted
time: 1ms
memory: 1252kb

input:

5000
531217474 789091721 215252536 372835317 700423035 974711427 652748402 571305285 997008504 37363...

output:

559977641873536224
224292145735286345
702662681810450139
778411160442528443
897340275350108544
58787...

result:

ok 4999 numbers

Test #5:

score: 10
Accepted
time: 2ms
memory: 1252kb

input:

5000
910423957 165986780 943714472 831155998 709013843 269473126 632360447 139858782 923053920 12371...

output:

742830227290764950
76750290844019519
14282397106876542
575540219818005582
107219569506564802
1709356...

result:

ok 4999 numbers

Test #6:

score: 10
Accepted
time: 463ms
memory: 12904kb

input:

1000000
98378960 815273171 798527144 56276225 326952268 191416604 442940788 417409004 506944194 2641...

output:

101249486025565073
183843990354960429
52840814951330268
412436706043203972
256884545667608880
828698...

result:

ok 999999 numbers

Test #7:

score: 10
Accepted
time: 470ms
memory: 12904kb

input:

1000000
768864484 338833208 817166554 281484927 193649384 38376435 76366410 944256221 605145306 1320...

output:

68979361443810328
285879048479439729
315585458075336222
1137178003646092005
646330091029375749
92092...

result:

ok 999999 numbers

Test #8:

score: 10
Accepted
time: 396ms
memory: 12908kb

input:

1000000
465652692 341487258 736236779 223127377 483740656 100569409 307894190 223331213 918270622 14...

output:

830218144876462106
859713694499435763
1092102687413303058
827433194491416146
928193180106802806
1080...

result:

ok 999999 numbers

Test #9:

score: 10
Accepted
time: 317ms
memory: 12908kb

input:

1000000
458380145 5656703 672788495 688854766 141174693 721133442 723965137 391959978 175778473 6452...

output:

743740275918110562
688504828622761238
809679581132707858
1096088677794118390
927269021158712026
1008...

result:

ok 999999 numbers

Test #10:

score: 10
Accepted
time: 300ms
memory: 12904kb

input:

1000000
466301352 720158180 378002604 648267592 261297918 553747677 489172450 432418688 779084651 73...

output:

904308807488396727
796572657731139558
41089680038788312
839860487598530634
586534549895784896
650749...

result:

ok 999999 numbers

Extra Test:

score: 0
Extra Test Passed