Submission #41588

#TimeUsernameProblemLanguageResultExecution timeMemory
41588repeatingBali Sculptures (APIO15_sculpture)C++11
50 / 100
216 ms1160 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[2002]; int DP(int x){ if(x==n)R 0; int &ret=dp[x]; if(ret!=-1)R ret; ret=INF; ll sum=0; for(int i=x;i<n;i++){ sum+=a[i]; if((sum&notis)==0){ret=min(ret,DP(i+1)+1);} } R ret; } int main(){ cin>>n>>l>>r; for(int i=0;i<n;i++)cin>>a[i]; // is=8; for(int i=50;i>=0;i--){ notis+=(1LL<<i); MEM(dp,-1); if(DP(0)>r){ is+=(1LL<<i); notis-=(1LL<<i); } // cout<<DP(0)<<" "; // 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...