Submission #206657

#TimeUsernameProblemLanguageResultExecution timeMemory
206657mayhoubsalehMean (info1cup19_mean)C++14
100 / 100
7 ms764 KiB
#include <bits/stdc++.h> #include <string> #define ll long long #define pb push_back #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const int maxn=222; ll n; ll a[maxn]; ll dp[maxn][maxn]; int main() { IOS cin>>n; for(ll i=0;i<n;i++)cin>>a[i]; for(ll r=0;r<n;r++){ dp[r][r]=a[r]; for(ll l=r-1;l>=0;l--){ for(ll mid=l;mid<r;mid++){ dp[l][r]=max(dp[l][r],(dp[l][mid]+dp[mid+1][r])/2); } } } cout<<dp[0][n-1]<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...