You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
761 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int a[N];
int main() {
int n;
while (~scanf("%d", &n) && n) {
int x = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
x = x ^ a[i];
}
if (!x)
puts("No");
else {
puts("Yes");
for (int i = 0; i < n; i++) {
int res = a[i] ^ x;
//找到了证明中提到的: a_i ,此堆的数量最高位第k位数值为1
//拿走a[i]- (a[i]^x)
//剩下a[i]^x = res个
if (res < a[i])
printf("%d %d\n", a[i], res);
}
}
}
return 0;
}