感觉复杂度很对啊/kel
#include <bits/stdc++.h>
using namespace std;
namespace z {
const int N = 5e5 + 5;
int n, k;
long long ans;
long long a[N];
void dfs(int x, int y, long long sum) {
if(y == k) {
ans = max(ans, sum);
return;
}
for(int i = x + 1; i <= n && (n - i + 1 + y) >= k; i++)
dfs(i, y + 1, sum ^ a[i]);
}
void main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
cin >> n >> k;
for(int i = 1; i <= n; i++) cin >> a[i];
dfs(0, 0, 0);
cout << ans << endl;
}
#undef int
}
int main()
{
z::main();
return 0;
}