mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
parent
9b665caa0b
commit
d44cea0747
24
S2OJ/1036/1036.cpp
Normal file
24
S2OJ/1036/1036.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int n;
|
||||
long long x, a[1000005], pre[1000005], suf[1000005], ans;
|
||||
|
||||
int main() {
|
||||
cin >> n >> x;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
for (int i = 1; i <= n; i++) {
|
||||
pre[i] = pre[i - 1] | a[i];
|
||||
}
|
||||
for (int i = n; i >= 1; i--) {
|
||||
suf[i] = suf[i + 1] | a[i];
|
||||
}
|
||||
for (int i = 1; i <= n; i++) {
|
||||
ans = max(ans, pre[i - 1] | (a[i] * x) | suf[i + 1]);
|
||||
}
|
||||
cout << ans << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user