Submission #674404

# Submission time Handle Problem Language Result Execution time Memory
674404 2022-12-24T03:25:09 Z QwertyPi Mean (info1cup19_mean) C++14
100 / 100
3 ms 468 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 200 + 11;
int a[MAXN];
int dp[MAXN][MAXN];

int main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}

	for(int i = 0; i < n; i++) dp[i][i] = a[i];
	for(int d = 1; d < n; d++){
		for(int i = 0; i < n - d; i++){
			int l = i, r = i + d;
			for(int m = l; m < r; m++){
				dp[l][r] = max(dp[l][r], (dp[l][m] + dp[m + 1][r]) / 2);
			}
		}
	}
	cout << dp[0][n - 1] << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 2 ms 432 KB Output is correct
20 Correct 2 ms 468 KB Output is correct