-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathGRAY CODE CODECHEF
59 lines (40 loc) · 919 Bytes
/
GRAY CODE CODECHEF
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
#include<bits/stdc++.h>
using namespace std;
# define ll unsigned long long
int main()
{
ll n; vector<ll>v; cin>>n;
for(ll i=0;i<n;i++)
{
ll no;
cin>>no;
if(n<130)
{
v.push_back(no);
}
}
if(n>=130)
{cout<<"Yes"<<endl;
return 0;
}
// brute force for small values , 4 nested loops to pick for nos.
for(ll i=0;i<n;i++)
{
for(ll j=i+1;j<n;j++)
{
for(ll k=j+1;k<n;k++)
{
for(ll p=k+1;p<n;p++)
{
if((v[i]^v[j]^v[k]^v[p])==0)
{
cout<<"Yes"<<endl;
return 0;
}
}
}
}
}
cout<<"No"<<endl;
return 0;
}