제출 #931221

#제출 시각아이디문제언어결과실행 시간메모리
931221hugsfromadictoMean (info1cup19_mean)C++14
100 / 100
3 ms604 KiB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int M = 1e18;
const int mxN = 205;
int a[mxN];
int dp[202][202];
void _()
{
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        dp[i][i] = a[i];
    }
    for(int len = 2; len <= n; len++){
        for(int i = 1; i <= n-len+1; i++){
            int j = i+len-1;
            for(int k = i; k < j; k++){
                dp[i][j] = max(dp[i][j], (dp[i][k] + dp[k+1][j])/2);
            }
        }
    }
    cout << dp[1][n];

}

main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  int tc = 1;
  //cin>>tc;
  while(tc--)
  {
      _();
  }

}


컴파일 시 표준 에러 (stderr) 메시지

mean.cpp:29:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   29 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...