Submission #202002

#TimeUsernameProblemLanguageResultExecution timeMemory
202002mdn2002Bali Sculptures (APIO15_sculpture)C++14
0 / 100
1097 ms33400 KiB
#include<bits/stdc++.h> using namespace std; const int mod=1e9+7; long long n,y[2050],dp[2050][2050],a,b; long long f(int x,int g) { if(x==n&&a<=g&&g<=b)return 0; if(x==n)return 1e18; //if(dp[x][g]!=-1)return dp[x][g]; long long ans=1e18,sum=0; for(int i=x;i<n;i++) { sum+=y[i]; ans=min(ans,(f(i+1,g+1)|sum)); } return dp[x][g]=ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("empty.in","r",stdin); //freopen("empty.out","w",stdout); memset(dp,-1,sizeof dp); cin>>n>>a>>b; for(int i=0;i<n;i++)cin>>y[i]; cout<<f(0,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...