Submission #1075515

#TimeUsernameProblemLanguageResultExecution timeMemory
1075515raduvMean (info1cup19_mean)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 200; int dp[MAXN + 1][MAXN + 1]; // dp[i][j] = maximul dupa aplicarea operatiilor pentru subsecv (i, j) int v[MAXN + 1]; int main() { int n, i, j, k; scanf("%d", &n); for( i = 1; i <= n; i++ ){ scanf("%d", &v[i]); dp[i][i] = v[i]; } for( i = 1; i <= n; i++ ){ for( j = i + 1; j <= n; j++ ){ for( k = i; k <= j; k++ ){ dp[i][j] = max(dp[i][j], (dp[i][k] + dp[k + 1][j]) / 2); } } } printf("%d\n", dp[1][n]); return 0; }

Compilation message (stderr)

mean.cpp: In function 'int main()':
mean.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
mean.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d", &v[i]);
      |     ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...