记录编号 |
602355 |
评测结果 |
AAAAAAAAAA |
题目名称 |
4167.镜牢 |
最终得分 |
100 |
用户昵称 |
LikableP |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.698 s |
提交时间 |
2025-07-03 17:08:55 |
内存使用 |
3.03 MiB |
显示代码纯文本
#include <cstdio>
typedef long long ll;
template <typename T> T read();
template <typename T> void write(T, char);
const int MAXN = 1e5 + 10;
int n;
ll a[MAXN], b[MAXN], c[MAXN];
ll ans;
int main() {
freopen("./mirror.in", "r", stdin);
freopen("./mirror.out", "w", stdout);
n = read<int>();
for (int i = 1; i <= n; ++i) a[i] = read<ll>(), ans ^= a[i];
for (int i = 1; i <= n; ++i) b[i] = read<ll>(), b[i] ^= a[i];
fprintf(stderr, "*1*\n");
for (int i = 1; i <= n; ++i) c[i] = read<ll>();
fprintf(stderr, "*2*\n");
for (int bit = 60; bit >= 0; --bit) {
ll x = 0, y = 0;
for (int i = n; i >= 1; --i) {
if (b[i] >> bit & 1) {
b[i] ^= (x ? x : (y = c[i], x = b[i]));
}
}
ans ^= ((ans >> bit & 1) ^ y) * x;
}
write(ans, '\n');
return 0;
}
#define isdigit(ch) (ch >= '0' && ch <= '9')
template <typename T> T read() {
T res = 0, f = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-') f = -1;
for (; isdigit(ch); ch = getchar()) res = (res << 3) + (res << 1) + (ch ^ 48);
return res * f;
}
template <typename T> void write(T x, char ed) {
if (x < 0) x = -x, putchar('-');
static int sta[sizeof(T) << 2], top = 0;
do {
sta[++top] = x % 10;
x /= 10;
} while (x);
while (top) {
putchar(sta[top--] ^ 48);
}
putchar(ed);
}