Untitled
unknown
plain_text
2 years ago
516 B
9
Indexable
Never
#include <bits/stdc++.h> using namespace std; int main() { //cout << (6&4) << endl; int t,n; cin >> t; for(int i=0;i<t;++i){ cin >> n ; int arr[n]; for(int j=0;j<n;++j){ cin >> arr[j]; } int mx = -1,x; for(int j=0;j<n;++j){ if(arr[j] != j){ x = arr[j] & j; if(x > mx) mx = x; } } cout << mx << endl; } return 0; }