比赛 26暑假集训模拟赛1 评测结果 AAAAAAAAAA
题目名称 异或加密 最终得分 100
用户昵称 赵飞羽 运行时间 1.906 s
代码语言 C++ 内存使用 9.22 MiB
提交时间 2026-06-29 08:54:19
显示代码纯文本
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N = 1000010, L = 40;
int n, a[N], b[N], c[L], d[L], ans;

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	freopen("XORcipher.in", "r", stdin);
	freopen("XORcipher.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 = 0; i < L; i++) {
		for (int j = 1; j <= n; j++) {
			if (a[j]&(1ll<<i)) c[i]++;
			if (b[j]&(1ll<<i)) d[i]++;
		}
	}
	for (int i = 0; i < L; i++) ans += ((c[i]!=d[i])<<i);
	cout << ans;
	return 0;
}