Submission #15455

#TimeUsernameProblemLanguageResultExecution timeMemory
15455tonyjjw달리는 게임 (kriii3_E)C++98
0 / 70
0 ms32364 KiB
#include<stdio.h> int n; long long int a[1001000]; long long int s[1001000]; long long int d[1001000]; long long int dp[1001000]; int main(){ long long int i,j,k; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%lld",&a[i]); s[i+1]=s[i]+a[i]; d[i+1]=d[i]+s[i+1]; } for(i=0;i<=n;i++){ printf("%lld ",dp[i]); k=0; for(j=i+1;j<=n+1;j++){ if(dp[j]<dp[i]+k)dp[j]=dp[i]+k; k+=a[j-1]*(j-i); } } printf("%lld",dp[n+1]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...