Submission #1032903

#TimeUsernameProblemLanguageResultExecution timeMemory
1032903jnjwnwnwMean (info1cup19_mean)C++17
100 / 100
2 ms604 KiB
#include <algorithm> #include <iostream> using namespace std; #define ll long long #define fff(i,a,b) for(ll i = a; i < b; i++) #define MAXN 201 ll dp[MAXN][MAXN], A[MAXN]; ll n; #define mean(a, b) ((a+b)>>1) int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; fff(i, 0, n){ cin >> A[i]; dp[i][i] = A[i]; } fff(sz, 2, n+1){ fff(L, 0, n-sz+1){ ll R = L+sz-1; fff(K, L, R){ dp[L][R] = max(dp[L][R], mean(dp[L][K], dp[K+1][R])); } } } cout << dp[0][n-1] << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...