0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 20:48:48 +00:00

#1036. 【长郡5 10.13-T1】打打牌

https://sjzezoj.com/submission/37441
This commit is contained in:
Baoshuo Ren 2021-10-01 11:20:17 +08:00 committed by Baoshuo Ren
parent 9b665caa0b
commit d44cea0747
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

24
S2OJ/1036/1036.cpp Normal file
View 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;
}