# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15208 |
2015-07-12T03:56:04 Z |
gs14004 |
달리는 게임 (kriii3_E) |
C++14 |
|
2 ms |
32332 KB |
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long lint;
int n;
lint dp[1000005];
lint a[1000005];
lint s1[1000005];
lint s2[1000005];
int main(){
scanf("%d",&n);
for(int i=1; i<=n; i++){
scanf("%lld",&a[i]);
s1[i] = s1[i-1] + a[i];
s2[i] = s2[i-1] + s1[i];
}
for(int i=1; i<=n; i++){
dp[i] = dp[i-1];
for(int j=0; j<i; j++){
dp[i] = max(dp[i], dp[j] + s1[i] * (i - j + 1) + s2[j] - s2[i]);
}
}
printf("%lld",dp[n]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
32332 KB |
Output is correct |
2 |
Incorrect |
2 ms |
32332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |