제출 #645315

#제출 시각아이디문제언어결과실행 시간메모리
645315notmeMean (info1cup19_mean)C++14
100 / 100
4 ms596 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; const long long MAXN = 205; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } long long n, a[MAXN]; long long dp[MAXN][MAXN]; void solve() { cin >> n; for (long long i = 1; i <= n; ++ i) cin >> a[i]; for (int i = 1; i <= n; ++ i) dp[i][1] = a[i]; for (int len = 2; len <= n; ++ len) { for (int i = 1; i + len - 1 <= n; ++ i) { int j = i + len - 1; for (int k = 1; k <= len-1; ++ k) { long long res1 = dp[i][k]; long long res2 = dp[i+k][len-k]; dp[i][len] = max(dp[i][len], 1LL * (res1 + res2)/2); } ///cout << i << " " << len << " - > " << dp[i][len] << endl; } } cout << dp[1][n] << endl; } int main() { speed(); solve(); return 0; }

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

mean.cpp: In function 'void solve()':
mean.cpp:24:17: warning: unused variable 'j' [-Wunused-variable]
   24 |             int j = i + len - 1;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...