Submission #15498

#TimeUsernameProblemLanguageResultExecution timeMemory
15498progressive달리는 게임 (kriii3_E)C++14
26 / 70
2 ms1104 KiB
#include<cstdio> #include<algorithm> long long c[1500]; long long dp[1500]; int main() { int N; scanf("%d",&N); for(int i=1;i<=N;i++) scanf("%lld",c+i); dp[N+1]=0; for(int i=N;i>=0;i--) { dp[i]=dp[i+1]; long long inc=0; for(int j=i+1;j<=N+1;j++) { inc+=(j-i-1)*c[j-1]; dp[i]=std::max(dp[j]+inc,dp[i]); } } printf("%lld",dp[0]); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...