Submission #41589

#TimeUsernameProblemLanguageResultExecution timeMemory
41589repeatingBali Sculptures (APIO15_sculpture)C++11
71 / 100
39 ms1140 KiB
#include <bits/stdc++.h> #define F first #define S second #define P push #define pb push_back #define MEM(dp,i) memset(dp,i,sizeof(dp)) #define W while #define R return #define C continue #define SI size() #define ll long long #define ld long double #define pll pair<ll,ll> #define pii pair<int,int> #define SF(x) scanf("%Id",&x) #define SF2(x,y) scanf("%Id%Id",&x,&y) #define SF3(x,y,z) scanf("%I64d%I64d%I64d",&x,&y,&z) #define SF4(x,y,z,o) scanf("%I64d%I64d%I64d%I64d",&x,&y,&z,&o) #define all(v) v.begin(),v.end() using namespace std; const long long INF = 1e9; const long long MOD = 1e9+7; const int MX=200015; ll is=0,notis=0; int n,l,r,bit; int a[2222]; int dp[102][102]; int DP(int x,int u){ if(u>r)R 0; if(x==n)R (u>=l); int &ret=dp[x][u]; if(ret!=-1)R ret; ret=0; ll sum=0; for(int i=x;i<n;i++){ sum+=a[i]; if((sum&notis)==0){ret=max(ret,DP(i+1,u+1));} } R ret; } int main(){ cin>>n>>l>>r; for(int i=0;i<n;i++)cin>>a[i]; // is=8; for(int i=44;i>=0;i--){ notis+=(1LL<<i); MEM(dp,-1); if(DP(0,0)==0){ is+=(1LL<<i); notis-=(1LL<<i); } // cout<<is<<endl; } cout<<is; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...