# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1094819 | Faisal_Saqib | Bali Sculptures (APIO15_sculpture) | C++17 | 1068 ms | 1372 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 <iostream>
#include <set>
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long
const ll inf=1e18;
const ll N=2002;
ll pre[N];
ll pw2[38];
bool posp[N][N];
int main()
{
int n,a,b;
cin>>n>>a>>b;
pw2[0]=1;
for(int i=1;i<38;i++)
pw2[i]=(2ll*pw2[i-1]);
for(int i=0;i<n;i++)
{
cin>>pre[i+1];
pre[i+1]+=pre[i];
}
ll pos=pw2[37]-1;
for(int i=36;i>=0;i--)
{
ll new_pos=pos-pw2[i];
for(int i=0;i<=n;i++)
for(int j=0;j<=n;j++)
posp[i][j]=0;
posp[0][0]=1;
bool pos1=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
for(int k=0;k<i;k++)
{
if(posp[k][j-1])
{
bool das=1;
ll np=(pre[i]-pre[k]);
ll cur_or=(np|new_pos);
if(cur_or==new_pos)
posp[i][j]=1;
}
}
if(i==n and a<=j and j<=b and posp[i][j])
{
pos1=1;
}
}
}
if(pos1)
pos=new_pos;
}
cout<<pos<<'\n';
return 0;
}
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... |