Submission #15464

#TimeUsernameProblemLanguageResultExecution timeMemory
15464jeapi달리는 게임 (kriii3_E)C++98
0 / 70
4 ms5632 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...