Submission #919919

#TimeUsernameProblemLanguageResultExecution timeMemory
919919divadMean (info1cup19_mean)C++17
100 / 100
2 ms604 KiB
#include <bits/stdc++.h> using namespace std; const int NMAX = 202; int n,a[NMAX],dp[NMAX][NMAX]; void maxSelf(auto &a, auto b){ a = max(a, b); } int main() { 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++){ maxSelf(dp[i][j], (dp[i][k] + dp[k+1][j])/2); } } } cout << dp[1][n]; return 0; }

Compilation message (stderr)

mean.cpp:6:14: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
    6 | void maxSelf(auto &a, auto b){
      |              ^~~~
mean.cpp:6:23: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
    6 | void maxSelf(auto &a, auto b){
      |                       ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...