File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ // codechef-pigeonhole
2+ #include < bits/stdc++.h>
3+ using namespace std ;
4+ typedef unsigned long long ll;
5+ typedef vector<ll> vi;
6+ typedef vector<vi> vvi;
7+ const int mod = 1000000007 ;
8+ const int sze = 100010 ;
9+ void printMat (vvi& a) {for (int i = 0 ; i < a.size (); ++i) {for (int j = 0 ; j < a[0 ].size (); ++j)cout << a[i][j] << " " ;} cout << " \n " ;}
10+ int main () {
11+ ll arr[100000 ];
12+ int n;
13+ cin >> n;
14+ for (int i = 0 ; i < n; ++i) {
15+ cin >> arr[i];
16+ }
17+
18+ if (n >= 130 ) {
19+ cout << " Yes" ;
20+ return 0 ;
21+ }
22+
23+ sort (arr, arr + n);
24+ for (int i = 0 ; i < n-3 ; ++i){
25+ for (int j = i + 1 ; j < n -2 ; ++j ){
26+ for (int k = j + 1 ; k < n - 1 ; ++k){
27+ ll toFind = arr[i] ^ arr[j] ^ arr[k];
28+ if (binary_search (arr + k + 1 , arr + n, toFind)) {
29+ // returns true or false
30+ cout << " Yes" ;
31+ return 0 ;
32+ }
33+ }
34+ }
35+ }
36+
37+ cout << " No" ;
38+ }
You can’t perform that action at this time.
0 commit comments