제출 #205330

#제출 시각아이디문제언어결과실행 시간메모리
205330kshitij_sodaniBali Sculptures (APIO15_sculpture)C++17
0 / 100
5 ms380 KiB
#include <iostream> #include <bits/stdc++.h> using namespace std; typedef int64_t llo; #define mp make_pair #define pb push_back #define a first #define b second #define endl "\n" int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); llo n,a,b; cin>>n>>a>>b; llo it[n]; for(llo i=0;i<n;i++){ cin>>it[i]; } llo dp[n]; llo ans=0; memset(dp,0,sizeof(dp)); llo pre[n]; pre[0]=it[0]; for(llo i=1;i<n;i++){ pre[i]=pre[i-1]+it[i]; } for(llo i=42;i>=0;i--){ memset(dp,0,sizeof(dp)); //cout<<ans<<endl; ans=ans+(((llo)1<<(i))-(llo)1); // cout<<i<<endl; //cout<<ans<<endl; for(llo j=0;j<n;j++){ llo no=pre[j]; no|=ans; if(no==ans){ dp[j]=1; } for(llo l=0;l<j;l++){ llo no=(pre[j]-pre[l]); no|=ans; if(dp[l]==1 and (no==ans)){ if(dp[j]==0){ dp[j]=dp[l]+1; } dp[j]=min(dp[j],dp[l]+1); } } } ans-=(llo)(((llo)1<<(i))-(llo)1); //cout<<ans<<endl<<endl; llo st=1; for(llo j=n-1;j<n;j++){ if(dp[j]>0 and dp[j]<b+1){ st=0; break; } } if(st){ ans|=((llo)1<<i); } } cout<<ans<<endl; /*llo nno=8|3; //cout<<nno<<endl; */ return 0; }
#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...