ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#188439 | #3363. 序列价值 | JNE | 100 | 2156ms | 24628kb | C++11 | 988b | 2023-10-03 09:32:43 | 2023-10-03 12:12:49 |
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
struct node{
int val,next=-1,last=-1;
}s[1000005];
int n,b,ans;
signed main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%lld",&s[i].val);
if(i!=n)s[i].next=i+1;
if(i!=1)s[i].last=i-1;
if(i!=1)ans^=s[i].val*s[i-1].val;
}
printf("%lld\n",ans);
for(int i=1;i<=n-2;i++){
scanf("%d",&b);
if(s[b].last==-1){
s[s[b].next].last=-1;
ans^=s[b].val*s[s[b].next].val;
}
else if(s[b].next==-1){
s[s[b].last].next=-1;
ans^=s[b].val*s[s[b].last].val;
}
else{
ans^=s[b].val*s[s[b].last].val;
ans^=s[b].val*s[s[b].next].val;
ans^=s[s[b].last].val*s[s[b].next].val;
s[s[b].last].next=s[b].next;
s[s[b].next].last=s[b].last;
}
printf("%lld\n",ans);
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 24624kb
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: 3ms
memory: 24628kb
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: 24624kb
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: 4ms
memory: 24624kb
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: 3ms
memory: 24628kb
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: 532ms
memory: 24624kb
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: 527ms
memory: 24624kb
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: 478ms
memory: 24624kb
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: 289ms
memory: 24624kb
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: 320ms
memory: 24624kb
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