Submission #15464

# Submission time Handle Problem Language Result Execution time Memory
15464 2015-07-12T08:04:05 Z jeapi 달리는 게임 (kriii3_E) C++
0 / 70
4 ms 5632 KB
#include<iostream>
#include<algorithm>
using namespace std;
int D[1000][1000];
int M[1000];
int A[1000];
int main(){
	int N;
	int ans = 0;
	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> A[i];
	}
	for (int i = 0; i < N; i++){
		for (int j = i; j < N; j++){
			D[i][j] = D[i][j - 1] + (A[j] * (j - i + 1));
		}
	}
	for (int i = 0; i < N; i++){
		M[i] = D[0][i];
		for (int j = 0; j <= i; j++){
			M[i] = max(M[i], D[j][i] + M[j]);
		}
		ans = max(M[i], ans);
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 5632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -