// Alir3za.Zar3 -> Shiraz , Iran
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e3+7 , Lg = 48 , Inf = 2e18;
int n,A,B , v[N],q[N] , out;
void iN ()
{
cin >> n >> A >> B;
for (int i=1; i<=n; i++)
cin >> v[i];
for (int i=1; i<=n; i++)
v[i] += v[i-1];
}
bool Light_oK (int noT)
{
fill_n(q , n+1 , Inf);
q[0] = 0;
for (int i=1; i<=n; i++)
for (int j=0; j<i; j++)
if (!( (v[i]-v[j])&noT ))
q[i] = min(q[i] , q[j]+1);
return q[n] <= B;
}
void Light ()
{
int noT = 0;
for (int bit=Lg; bit>=0; bit--)
{
noT ^= 1ll<<bit;
if (!Light_oK(noT))
noT ^= 1ll<<bit,
out ^= 1ll<<bit;
}
}
void Heavy ()
{
}
void ouT ()
{
cout << out << '\n';
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
iN();
if (A==1) Light();
else Heavy();
ouT();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |