제출 #1011243

#제출 시각아이디문제언어결과실행 시간메모리
1011243AndrijaMMean (info1cup19_mean)C++14
100 / 100
6 ms856 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; 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++) { if(i+nL<n) 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...