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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 200000;
const int maxv = 62 * 62;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int x[n];
for(int i=0;i<n;i++)
{
cin>>x[i];
}
int dp[n][n+1];
memset(dp,0,sizeof dp);
for(int i=0;i<n;i++)
{
dp[i][1]=x[i];
}
for(int len=2;len<=n;len++)
{
for(int i=0;i<n;i++)
{
for(int nL=1;nL<len;nL++)
{
dp[i][len]=max(dp[i][len],(dp[i][nL]+dp[i+nL][len-nL])/2);
}
}
}
cout<<dp[0][n]<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |