比赛 |
集训 |
评测结果 |
AAAEEEEEEE |
题目名称 |
镜牢 |
最终得分 |
30 |
用户昵称 |
对立猫猫对立 |
运行时间 |
1.199 s |
代码语言 |
C++ |
内存使用 |
3.89 MiB |
提交时间 |
2025-07-03 09:21:26 |
显示代码纯文本
#include <bits/stdc++.h>
#define N 50005
#define ll unsigned long long int
using namespace std;
int n, c[N];
ll a[N], b[N];
ll dfs(int cnt, ll x) {
if (cnt == n + 1) return x;
else {
if (a[cnt] == b[cnt]) {
return dfs(cnt + 1, x ^ a[cnt]);
}
if (c[cnt] == 1) {
return max(dfs(cnt + 1, x ^ a[cnt]), dfs(cnt + 1, x ^ b[cnt]));
}
else {
return min(dfs(cnt + 1, x ^ a[cnt]), dfs(cnt + 1, x ^ b[cnt]));
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
freopen("mirror.in", "r", stdin);
freopen("mirror.out", "w", stdout);
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];
cout << dfs(1, 0) << endl;
return 0;
}