Submission #15249

# Submission time Handle Problem Language Result Execution time Memory
15249 2015-07-12T04:35:48 Z gs13068 달리는 게임 (kriii3_E) C++
0 / 70
2 ms 1116 KB
#include<cstdio>
#include<algorithm>

long long a[1111];
long long s[1111];
long long ss[1111];
long long d[1111];

int main()
{
    int i,j,n;
    scanf("%d",&n);
    for(i=1;i<=n;i++)scanf("%lld",&a[i]);
    for(i=n;i>=0;i--)
    {
        s[i]=s[i+1]+a[i];
        ss[i]=ss[i+1]+s[i+1];
        for(j=i+1;j<=n;j++)d[i]=std::max(d[i],d[j]+ss[i]-ss[j]-s[j+1]*(j-i));
    }
    printf("%lld\n",d[0]);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1116 KB Output is correct
2 Incorrect 2 ms 1116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -