-
Notifications
You must be signed in to change notification settings - Fork 1
/
D.cpp
52 lines (47 loc) · 1.17 KB
/
D.cpp
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
//DIABLOX
#include <bits/stdc++.h>
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define printv(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c, d)))
#define max3(a,b,c) max(a,max(b,c))
#define REP(i, a, b) for(int i = a; i < b; i++)
#define FOR(i, a) for(auto & i : a)
#define len(s) (int)s.size()
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
// FAST INPUT
void DIABLOX(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << setprecision(8) << fixed;
}
// #ifndef ONLINE_JUDGE
// freopen("in", "r", stdin);
// freopen("out", "w", stdout);
// #endif
int main()
{
DIABLOX();
ll t=1;
cin >> t;
while(t--){
ll n; cin >> n;
vector<ll> a(n);
FOR(x, a) cin >> x;
vector<ll> ans(n);
ans[0] = 0;
ll x = a[0] ^ ans[0];
REP(i, 1, n){
x = a[i - 1] ^ ans[ i - 1];
ans[i] = (x | a[i]) ^ a[i];
}
printv(ans);
}
return 0;
}