-
Notifications
You must be signed in to change notification settings - Fork 3
/
A_NIT_orz.cpp
83 lines (57 loc) · 1.83 KB
/
A_NIT_orz.cpp
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma")
#include<bits/stdc++.h>
//ordered set
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
// Header Files End
using namespace std;
using namespace __gnu_pbds;
//typedef tree<pair<int, int>, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
// find_by_order --> find the element at the ith index
// order_of_key --> find the element smaller than the parameter passed in the array
//if you want to arrange the values in descending order replace less<int> with greater<int>
//less_equal for multiple values
template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> ;
//ordered_set<pair<int, int>> A; , ordered<int> A;
template<class key, class value, class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
#define int long long
double pi = 3.14159265358979323846;
#define PB push_back
#define MP make_pair
#define INF 1000000007
const int mod = 1e9 + 7;
//vector<int> graph[(int)1000]; //defining array of vectors
//to_ullong()
int case_ans = 1;
//cout << "Case #" << case_ans << ": " << ans << endl;
void solve() {
int n, z;
cin >> n >> z;
int maxi = -1;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
maxi = max(maxi, (x | z));
}
cout << maxi << endl;
}
int32_t main() {
#ifndef ONLINE_JUDGE
freopen("ccallinput.txt", "r", stdin);
freopen("ccalloutput.txt", "w", stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}