比赛 集训 评测结果 AAATTTTTTT
题目名称 镜牢 最终得分 30
用户昵称 pcx 运行时间 14.029 s
代码语言 C++ 内存使用 8.26 MiB
提交时间 2025-07-03 10:02:51
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
typedef long long LL;
LL a[N],b[N],c[N],mx;
LL dfs(LL r,LL x,LL n){
    if(r>n){
        return x;
    }
    if(c[r]==1){
        LL ca=dfs(r+1,x^a[r],n);
        LL cb=dfs(r+1,x^b[r],n);
        return max(ca,cb);
    }else{
        LL ea=dfs(r+1,x^a[r],n);
        LL eb=dfs(r+1,x^b[r],n);
        return min(ea,eb);
    }
}
int main(){
    freopen("mirror.in","r",stdin);
    freopen("mirror.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0); 
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) cin>>b[i];
    for(int i=1;i<=n;i++) cin>>c[i];
    LL mx=dfs(1,0,n);
    cout<<mx;
    return 0;
}