ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#188396 | #3363. 序列价值 | AndyLuo | 100 | 2077ms | 32412kb | C++11 | 911b | 2023-10-03 09:08:34 | 2023-10-03 12:08:32 |
answer
#include <bits/stdc++.h>
using namespace std;
long long read() {
long long 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 << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
long long n,a[1000050],b[1000050],l[1000050],r[1000050],ans;
int main() {
n = read();
for (int i = 1; i <= n; i++) {
a[i] = read();
l[i] = i - 1;
r[i] = i + 1;
}
r[n] = 0;
for (int i = 1; i < n; i++) {
ans = (ans ^ (a[i] * a[i + 1]));
}
for (int i = 1; i <= n - 2; i++) {
b[i] = read();
}
cout << ans << "\n";
for (int i = 1; i <= n - 2; i++) {
ans = (ans ^ (a[l[b[i]]] * a[b[i]]) ^ (a[b[i]] * a[r[b[i]]]));
ans = (ans ^ (a[l[b[i]]] * a[r[b[i]]]));
r[l[b[i]]] = r[b[i]];
l[r[b[i]]] = l[b[i]];
cout << ans << "\n";
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 3332kb
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: 3332kb
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: 3336kb
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: 0ms
memory: 3332kb
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: 0ms
memory: 3332kb
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: 559ms
memory: 32408kb
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: 502ms
memory: 32408kb
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: 511ms
memory: 32408kb
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: 268ms
memory: 32408kb
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: 237ms
memory: 32412kb
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