Submission #15456

# Submission time Handle Problem Language Result Execution time Memory
15456 2015-07-12T08:00:16 Z tonyjjw 달리는 게임 (kriii3_E) C++
26 / 70
1000 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++){
		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 Correct 0 ms 32364 KB Output is correct
2 Correct 0 ms 32364 KB Output is correct
3 Correct 0 ms 32364 KB Output is correct
4 Correct 0 ms 32364 KB Output is correct
5 Correct 0 ms 32364 KB Output is correct
6 Correct 0 ms 32364 KB Output is correct
7 Correct 0 ms 32364 KB Output is correct
8 Correct 0 ms 32364 KB Output is correct
9 Correct 0 ms 32364 KB Output is correct
10 Correct 2 ms 32364 KB Output is correct
11 Correct 0 ms 32364 KB Output is correct
12 Correct 0 ms 32364 KB Output is correct
13 Correct 0 ms 32364 KB Output is correct
14 Correct 2 ms 32364 KB Output is correct
15 Correct 2 ms 32364 KB Output is correct
16 Correct 2 ms 32364 KB Output is correct
17 Correct 2 ms 32364 KB Output is correct
18 Correct 0 ms 32364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 32360 KB Program timed out
2 Halted 0 ms 0 KB -