记录编号 |
602361 |
评测结果 |
AAAAAAAAAA |
题目名称 |
4167.镜牢 |
最终得分 |
100 |
用户昵称 |
李奇文 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.639 s |
提交时间 |
2025-07-03 17:27:30 |
内存使用 |
5.44 MiB |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
freopen("mirror.in","r",stdin);
freopen("mirror.out","w",stdout);
int n;
scanf("%lld",&n);
int a[n+1]={},b[n+1]={},h[61]={},s[61]={},c[n+5]={},d=0,ans=0;
for(int i=0;i<n;i++){
scanf("%lld",&a[i]);
d^=a[i];
}
for(int i=0;i<n;i++){
scanf("%lld",&b[i]);
b[i]^=a[i];
}
for(int i=0;i<n;i++){
scanf("%lld",&c[i]);
}
for(int i=n-1;i>=0;i--){
int x=b[i],cc=c[i];
for(int i=60-1;i>=0;i--){
if(x>>i&1){
if(h[i]) x^=h[i];
else{
for(int j=i-1;j>=0;j--){
if(x>>j&1){
x^=h[j];
}
}
h[i]=x;
for(int j=60-1;j>i;j--){
if(h[j]>>i&1){
h[j]^=h[i];
}
}
s[i]=cc;
break;
}
}
}
}
for(int i=60-1;i>=0;i--){
if(d>>i&1){
d^=h[i];
}
}
for(int i=0;i<60;i++){
if(s[i]==1){
ans^=h[i];
}
}
printf("%lld\n",d^ans);
return 0;
}