-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTAAND.cpp
More file actions
67 lines (66 loc) · 1.33 KB
/
Copy pathTAAND.cpp
File metadata and controls
67 lines (66 loc) · 1.33 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
62
63
64
65
66
///*Bismillahir Rahmanir Rahim***///
/***Stay_Home_Stay_Safe***/
///**Author Thasin Sheikh**///
#include<bits/stdc++.h>
using namespace std;
#define MAX 1e6+10
#define MOD 1000000007
#define PI 3.14159265359
#define makefast__ ios_base::sync_with_stdio(false);
using ll=long long int ;
using dl =double;
const int N = 2e5 + 10;
ll aarray[300000+10];
ll magic[101][101];
vector<ll>primes;
bool prime[1000001];
ll flag[300000+10];
ll n;
ll solve()
{
ll i,j,ans=0,c,m,k;
memset(flag,0,sizeof(flag));
for(i=30; i>=0; i--)
{
c=0;
for(j=1; j<=n; j++)
{
if((aarray[j]&(1<<i)))
{
c++;
}
}
//cout<<c<<endl;
if(c>=2)
{
ans+=(1<<i);
for(j=1; j<=n; j++)
{
if((aarray[j]&(1<<i))==0)
aarray[j]=0;
}
}
//cout<<ans<<" ";
}
cout<<ans<<endl;
}
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
makefast__
string str;
ll a,b,c,d,e,f,x,y,k,t,q,p,A=0,mod,B=0,L,j,i,l,r,m,C=0,ans=0,sum=0,sum1=0;
vector<ll>v,v1;
queue<ll>qu;
/*cin>>f;
bitset<32>binary(f);
cout<<binary<<endl;*/
cin>>n;
for(i=1; i<=n; i++)
{
cin>>aarray[i];
}
solve();
return 0;
}