# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
213178 | KoalaMuch | Bali Sculptures (APIO15_sculpture) | C++14 | 106 ms | 512 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int N = 2005;
long long dp[N];
long long a[N];
int main()
{
long long n,l,r,fix = 0;
scanf("%lld %lld %lld",&n,&l,&r);
for(long long i=1;i<=n;i++) scanf("%lld",&a[i]);
for(long long bit=41;bit>=0;bit--)
{
for(long long i=1;i<=n;i++)
{
dp[i] = 1e9;
long long s = 0;
for(long long j=i;j>=1;j--)
{
s+=a[j];
// if(bit==0&&i==7&&j==7) printf("[%lld %lld %lld %lld]\n",s,s|fix,s-(s&fix),dp[j-1]);
if(s-(s&fix)<(1ll<<bit)&&dp[j-1]+1<=r) dp[i] = min(dp[i],dp[j-1]+1);
}
// if(!bit) printf("%lld %lld\n",i,dp[i]);
}
if(dp[n]==1e9) fix|=(1ll<<bit);
}
printf("%lld\n",fix);
return 0;
}
/*
6 1 3
8 1 2 1 5 4
8 1 4
1 2 1 1 1 0 4 6
*/
Compilation message (stderr)
# | 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... |