-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp14936.cpp
More file actions
61 lines (53 loc) · 1.17 KB
/
Copy pathp14936.cpp
File metadata and controls
61 lines (53 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// Created by HEYX on 2026/1/15.
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define NAMESPACE_BEGIN(name) namespace name {
#define NAMESPACE_END }
NAMESPACE_BEGIN(Hyx)
#ifndef ONLINE_JUDGE
#include "debug_template.hpp"
#else
#define debug(...)
#define debugArr(...)
#endif // ONLINE_JUDGE
int n;
int a[100000];
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "rb", stdin);
// freopen("output.txt", "wb", stdout);
#endif // ONLINE_JUDGE
int t;
cin >> t;
while (t--) {
cin >> n;
int xorsum = 0, mex = 0;
for (int i = 1; i <= n; i++) cin >> a[i], xorsum ^= a[i];
sort(a + 1, a + n + 1);
for (int i = 1; i <= n; i++) mex += a[i] == mex;
if (xorsum == mex) {
cout << "0\n\n";
} else {
if (xorsum != 0) {
cout << "1\n";
cout << (xorsum^mex) << "\n";
} else {
cout << "2\n";
cout << ((1 << 30) - 1) << " " << (((1 << 30) - 1) ^ mex) << "\n"; // 注意 << 是位运算符
}
}
}
return 0;
}
NAMESPACE_END
int main() {
#ifndef ONLINE_JUDGE
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#endif // ONLINE_JUDGE
return Hyx::main();
}