# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
645315 | 2022-09-26T18:24:16 Z | notme | Mean (info1cup19_mean) | C++14 | 4 ms | 596 KB |
#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; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 468 KB | Output is correct |
14 | Correct | 1 ms | 468 KB | Output is correct |
15 | Correct | 1 ms | 468 KB | Output is correct |
16 | Correct | 1 ms | 460 KB | Output is correct |
17 | Correct | 3 ms | 596 KB | Output is correct |
18 | Correct | 4 ms | 596 KB | Output is correct |
19 | Correct | 3 ms | 596 KB | Output is correct |
20 | Correct | 3 ms | 596 KB | Output is correct |