-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB_AND_Sorting.cpp
More file actions
47 lines (35 loc) · 761 Bytes
/
Copy pathB_AND_Sorting.cpp
File metadata and controls
47 lines (35 loc) · 761 Bytes
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
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rep(i, a, b) for (int i = a; i < b; i++)
void solve() {
}
int main() {
fastio;
int t;
cin >> t;
for(int k = 1;k<=t;k++){
int n;
cin>>n;
vector<int> arr(n);
for(int i=0;i<n;i++){
cin>>arr[i];
}
int ans = 1;
for(int i=0;i<30;i++){
ans = ans<<1;
//cout<<ans<<" ";
ans+=1;
}
for(int i=0;i<n;i++){
if(arr[i]!=i) ans&=arr[i];
}
cout<<ans<<endl;
}
return 0;
}