Submission #15455

# Submission time Handle Problem Language Result Execution time Memory
15455 2015-07-12T07:59:09 Z tonyjjw 달리는 게임 (kriii3_E) C++
0 / 70
0 ms 32364 KB
#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 time Memory Grader output
1 Incorrect 0 ms 32364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -